I have an asp drowndownlist and I'd like to change its selection after a button click. I can't seem to find a way to do this, is there a way? (Its a reset button of sorts, and I would like the dropdownlist to return to the "default" value.)
A:
In the click event can you do:
DropDownList.SelectedItem = "whatever";
DropDownList.DataBind()
?
Jack Marchetti
2009-10-16 14:41:00
SelectedItem is readonly?
Shawn
2009-10-16 14:43:10
No. Because the index is zero-based, the item at index 0 could be a valid selection. Setting SelectedIndex to -1 means nothing is selected. Or that's my understanding anyways.
PhilPursglove
2009-10-16 14:54:02