I have to insert \"Select\" at top after combobox is bound from dataset.i tried this but it isn\'t working.Throws error \"dataset doesn\'t have any definition for cast\".I t
You cannot add items to a ComboBox
after binding it to a data source. To add or remove items from a ComboBox
with a bound data source, you have to do it through data source itself.
You can insert a DataRow
into your table and it will be automatically added to your ComboBox
. Try the following:
DataRow dr = dsCat.Tables[0].NewRow();
dr["CategoryName"] = "Select";
dr["ID"] = 123;// Some ID
dsCat.Tables[0].Rows.Add(dr);