Maneesh A N

Maneesh A N

  • NA
  • 179
  • 108.5k

Return checkboxlist

Oct 6 2014 12:18 AM
HI

   I am facing problem in finding the checked items in checkbox list. Actually the list items for the    checkbox list are loaded from database. But by using the code below i am not able to find the         checked item in the list and the items are always returning false. Below is my code Can someone please help me with this?
   Please be correct.i need to get return items which is checked in check box list from in c#

Class1.connect();
SqlDataAdapter sda4 = new SqlDataAdapter("prcchklisttestupdate", Class1.con);
sda4.SelectCommand.CommandType = CommandType.StoredProcedure;
sda4.SelectCommand.Parameters.AddWithValue("@ibookingid", SqlDbType.Int).Value = label6.Text;
DataTable dt4 = new DataTable();
sda4.Fill(dt4);

for (int i2 = 0; i2 < dt4.Rows.Count; i2++)
{
foreach (string item in chkList1.Items)
{
if (item == dt4.Rows[i2][0].ToString())
{
chkList1.SelectedValue = true;
}
}

}

Answers (1)