Search code examples
asp.netajaxcomboboxajaxcontroltoolkitvb.net-2010

Ajax combobox with asp.net


i'm using a Combobox from AjaxControlToolkit in asp.net i'm filling this combobox with data from a database using sql Data Source, but i need to add an empty field in the combobox so in other words i need to add an empty row to the datatable but i'm using an sql data source so how can i do that ?

 <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

 <asp:ComboBox ID="service_listt" runat="server" AutoPostBack="true" DataTextField="CL_DESCRIPTION" DataValueField="CL_ID" DataSourceID="SqlDataSource1" CssClass="RedTypeComboBoxStyle" >
 </asp:ComboBox>  

Solution

  • Please look at this question:

    DropDownList AppendDataBoundItems (first item to be blank and no duplicates)

    Basically you could use AppendDataDoundItems property or use OnDataBound event to insert the empty value