Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Clear AjaxControlToolkit ComboBox

$
0
0

I have a ComboBox control from AjaxControlToolkit, it works fine. But I can not clear selected item to empty (when page is load, it show nothing, and then I can either click dropdown to pick an item or type in an item) I have button and I want to clear my select after click the button. I tired several ways but neither works.

My ComboBox like this:

<asp:ComboBox ID="ComboBox1" runat="server" AutoCompleteMode="Suggest"
DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="NameID"
EnableViewState="False" MaxLength="0"
style="display: inline;" Width="86px"></asp:ComboBox>

and DropDwonStyle property is default (DropDown).

I tried:

1. ComboBox1.SelectedIndex = -1

2. ComboBox.SelectedItem.Text = ""

3. ComboBox1.SelectedValue = -1

4. ComboBox.Item.Clear()

Is There a way to clear the selection? Thanks.


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>