I'm using the new Microsoft ASP.NET Ajax ComboBox control in my web application, and I'm having trouble figuring out how to programmatically set the selected list item. For example, I have a form to accept addresses and a ComboBox to accept a city name. After the user enters and saves and address, I'd like to reset the form, including the ComboBoxes.
With a regular ASP.NET dropdownlist control I can reset the selected item like below:
City.SelectedIndex = -1;
The ASP.NET AJAX ComboBox control accepts this line of code; but when the page posts back, the previously selected value is still selected. Help would be appreciated.
Update: I tried the following to no avail...
City.ClearSelection();
One Solution for this is use Following 2 Commands Before you load page Second time or make it visible in update Panel
Combobox1.ClearSelection()
Combobox1.Dispose()
This will Clear Combobox Value.
Hope this Helps. Took me a while to find it.
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