[RESOLVED]How To Bind DataTable to AjaxCombo Box

Hi All

Im Trying to Bind Dataset To Ajax Combobox By using Below code

<asp:ComboBox ID="cmbClientnames" runat="server" DropDownStyle="DropDownList">
 public System.Data.DataSet GetClientNames()
        System.Data.DataSet dsClients = service.GetAllClientNamesAndIds();
        if (dsClients.Tables[0].Rows.Count > 0)

            return dsClients;
            dsClients = null;
        return dsClients;
  System.Data.DataSet DsClientnames = GetClientNames();
            cmbClientnames.DataTextField = "cl_name";
            cmbClientnames.DataValueField = "cl_id";
            cmbClientnames.DataSource = DsClientnames.Tables[0].Columns[1]; here im getting Error 
Data source is an invalid type.  It must be either an IListSource, IEnumerable, or IDataSource.

how to convert dataset data to IListSource or IEnumerable
Thanks In Advance

you have to do like below i think

cmbClientnames.DataSource = DsClientnames.Tables[0];

and you may use objectdatasource to bend it

and here some useful link


Leave a Reply