|
-
Oct 6th, 2004, 08:01 PM
#1
Thread Starter
Banned
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,
-
Oct 6th, 2004, 11:05 PM
#2
PowerPoster
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"));
-
Oct 7th, 2004, 08:52 AM
#3
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
-
Oct 7th, 2004, 08:53 AM
#4
Look at all the combos on VBF...they all have a desc as their 1st entry.
Woka
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|