I want to match the values from reader and checkbox to change selected values of item of checkboxlist. But it does not work and I don't know what to do? Thanks.
while (reader.Read())
{
CheckBoxList1.Items.FindByValue(reader["malzeme_id"].ToString()).Selected = true;
}
I tried also,
while (reader.Read())
{
for (int i = 0; i < CheckBoxList1.Items.Count; i++)
{
if (CheckBoxList1.Items[i].Value.Equals(reader["malzeme_id"].ToString()))
{
CheckBoxList1.Items[i].Selected = Convert.ToBoolean( reader["isSelected"]);
}
}