User-1499457942 posted
Hi
I have below code . ON below line it is giving above error . There are 2 records in dt
lst.DataSource = dt;
using (SqlConnection con = new SqlConnection(CommonFunction.connectionString))
{
SqlCommand cmd = new SqlCommand("Select Location from [Loc]", con);
cmd.CommandType = CommandType.Text;
con.Open();
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
if (dt.Rows.Count > 0)
{
CheckBoxList lst = (CheckBoxList)e.Row.FindControl("ChekcBoxList1");
lst.DataSource = dt;
lst.DataBind();
}
}
Thanks