clear dropdownlist field
ASP.NET
2
Posts
2
Posters
0
Views
1
Watching
-
How can I clear a dropdownlist selected field without it removing the item out of the list? When I do: DropDownList1.SelectedItem.Text = "" it will clear the selected item out of the display and the list. jds1207
jds1207 wrote:
When I do: DropDownList1.SelectedItem.Text = "" it will clear the selected item out of the display and the list.
No, it will set the text of the selected item to an empty string. You can't clear the selection of a
DropDownList
, there is always one item selected. Set theSelectedIndex
property to zero if you want to reset it back to have the first item selected.Despite everything, the person most likely to be fooling you next is yourself.