dropdownlist SelectedIndex property

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
 
A

Anders Norås [MCAD]

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/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top