Hi
I have one checklist reading it from sqldatasource it was working fine to checked the selected type the user saved it before to view you it in the Edit form
now it's not getting to the loop :(
this is my code
SqlConnection con = new SqlConnection(myconn);
string Reg = Session["Reg"].ToString();
string sqlstr = "SELECT REG_no,Cat,Reg_date,ID FROM tblSu_Details WHERE REG_no ='" + Label24.Text + "'";
con.Open();
SqlCommand cmd = new SqlCommand(sqlstr, con);
cmd.CommandType = CommandType.Text;
cmd.CommandTimeout = 15;
SqlDataAdapter ad = new SqlDataAdapter(cmd);
DataSet DS = new System.Data.DataSet(cmd.CommandText);
ad.Fill(DS);
string sqlstr2 = "SELECT ID_Tye, Type_Name FROM tblType where ID_Type = " + DS.Tables[0].Rows[0].ItemArray[3].ToString();
SqlCommand cmd2 = new SqlCommand(sqlstr2, con);
cmd2.CommandType = CommandType.Text;
cmd2.CommandTimeout = 15;
SqlDataAdapter ad2 = new SqlDataAdapter(cmd2);
DataSet DS2 = new System.Data.DataSet(cmd2.CommandText);
ad2.Fill(DS2);
if (DS2.Tables[0].Rows.Count > 0)
{
foreach (DataRow drtmp in DS2.Tables[0].Rows)
{
foreach (ListItem litem6 in chktype.Items)
{
if (litem6.Text == drtmp.ItemArray[1].ToString())
{
litem6.Selected = true;
}
}
}
}