How can I select a dropdownlist?

Ennio

Member
Joined
Mar 5, 2006
Messages
23
Programming Experience
Beginner
I need to select a drop down list with some data from the DB, how can I do that?
 
Do you mean DropDownList.Focus to set focus to the control, or DropDownList.SelectedIndex=x to select an item in the list perhaps?
 
DropDownList.SelectedIndex=x

I got it to work, but for some reason if I delete some data from the DB I get an error saying it's out of range....
 
If there are less items in list than the selected index you get error out of range.
Make sure SelectedIndex is within range or deselect with value -1 before update/bind.
 
Back
Top