-
ddl in asp.net
When I load a drop down list it automatically selects the first value
in the list. I tried doing this:
Me.ddlCustomers.SelectedIndex=-1
hoping it would make sure nothing is selected and that didnt work.
I just want to make sure the user selects something so that the combo box triggers the ChangeSelectedIndex event. Right now if it has a value it doesnt run that code.
I want the combo boxes to have nothing selected at first.
I tried searching google with very little info :(.
Thanks,
-
After you bind the data or whatever, add a new item at index 0 that is just a space.
..databind code...
DropDownList1.Items.Insert(0, new ListItem(" ", "-1"));
-
If you look at most web sites they have either:
(Please Select One)
or
(None)
As the 1st entry. I believe this is to do what you want.
Woka
-
Look at all the combos on VBF...they all have a desc as their 1st entry.
Woka