List Info

Thread: DropDownList.SelectedIndex implementation




DropDownList.SelectedIndex implementation
user name
2006-04-24 16:45:21
Here is the implementation of DropDownList.SelectedIndex:

public override int get_SelectedIndex()
{
      int num1 = base.SelectedIndex;
      if ((num1 < 0) && (this.Items.Count >
0))
      {
            this.Items[0].Selected = true;
            num1 = 0;
      }
      return num1;
}

From this you can see that if the Items collection is not
empty there is no
way to clear the selection in DropDownList. Why would
Microsoft implement it
this way?

Alex

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )