dropdownlist SelectedIndex property

  • Thread starter Thread starter charmis
  • Start date Start date
C

charmis

In msdn library, DropDownList.SelectedIndex Property is defined as

[C#]
public override int SelectedIndex {get; set;}

The return type is int. In msdn library itself the int is defined as

The Int32 value type represents signed integers with values ranging from
negative 2,147,483,648 through positive 2,147,483,647

But when i assign the selectedIndex property with a value less than 0 , it
is taking it as 0.

Why?

regards
charmis
 
In msdn library, DropDownList.SelectedIndex Property is defined as
[C#]
public override int SelectedIndex {get; set;}

The return type is int. In msdn library itself the int is defined as

The Int32 value type represents signed integers with values ranging from
negative 2,147,483,648 through positive 2,147,483,647

But when i assign the selectedIndex property with a value less than 0 , it
is taking it as 0.

Why?
The SelectedIndex property holds the index of the selected item within the
Items collection. Items cannot be located before the start of the collection
(0). Therefore the SelectedIndex property only accepts positive values.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
 
Back
Top