It displays blank on combobox and list all and other items. I need to display all as first item on combobox
public void test()
{
DataTable dt1= new DataTable();
dt1 = d.test(infodisplay);
if (dt1.Rows.Count > 0)
{
DataRow dr = dt1.NewRow();
dr[0] = 0;
dr[1] = "All";
dt1.Rows.InsertAt(dr, 0);
cmbRack.DataSource = dt1;
cmbRack.DisplayMember = "Rack";
cmbRack.ValueMember="id";
//cmbRack.SelectedIndex =0;
}
}
public DataTable test(DisplayInfo dispinfo)
{
DataTable dt = new DataTable();
try
{
if (sqlcon.State == ConnectionState.Closed)
{
sqlcon.Open();
}
SqlCommand sccmd = new SqlCommand("Select id,Rack from display ", sqlcon);
SqlDataAdapter da = new SqlDataAdapter(sccmd);
da.Fill(dt);
}
catch
{
}
return dt;
}