I have a ASP DropDownList with items added to it. All what I want is to make the selection after the page loaded empty so there is no a selected item.
How can I do that?
If the dropdownlist is being populated by DataSource, is important do the DataBind before the insert. Otherwise the item insertion does not happen.
myDropDown.DataBind();
myDropDown.Items.Insert(0, new ListItem(string.Empty, string.Empty));
myDropDown.SelectedIndex = 0;
https://stackoverflow.com/a/2224636/1467453
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With