Solution 1:
DataTable dt = new DataTable();
// cboTown.Items.Clear();
if (obj.RowCount > 0)
{
// cboTown.Items.Insert(-1, “—-For All—-“);
dt = obj.DefaultView.Table;
DataRow row = dt.NewRow();
row[“town”] = “—-For All—-“;
row[“surveyformid”] = “0”;
dt.Rows.InsertAt(row, 0);
cboTown.DataSource = dt;
cboTown.DisplayMember = “town”;
cboTown.ValueMember = “surveyformid”;
this.cboTown.SelectedIndex = 0;
}
Solution 2;
DataTable table = new DataTable("myData"); using (SqlConnection conn = new SqlConnection(connString)) { using (SqlDataAdapter da = new SqlDataAdapter(@"SELECT * FROM MyTable", conn)) da.Fill(table); } DataRow row = table.NewRow(); row["town"] = "Please select bellow..."; row["surveyformid"] = "0"; table.Rows.InsertAt(row, 0); cboTown.DataSource = table; cboTown.DisplayMember = "town"; cboTown.ValueMember = "surveyformid"; this.cboTown.SelectedIndex = 0; this.cboTown.SelectedIndex = 0;