Click here to Skip to main content
15,904,416 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here ddlMachinayName is a dropdownList. Are the below two codes give the same answer ?
ddlMachinayName.SelectedIndex = -1;
ddlMachinayName.SelectedIndex = 0;
Posted
Updated 4-May-13 21:39pm
v2

1 solution

Refer - DropDownList.SelectedIndex Property[^], which says...
Quote:
The index of the selected item in the DropDownList control. The default value is 0, which selects the first item in the list.

The indexes for the items in the DropDownList control are zero-based.

So, both the -1 and 0 will result the same.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900