I have a code check the checkedlistbox checkboxes in asp.net/c#.
foreach (ListItem item in cbxlFeatures.Items)
{
foreach (DataRow row in dt.Rows)
{
if (item.Value.Equals(row["Id"].ToString()))
{
item.Selected = Convert.ToBoolean(row["Id"]);
// whenever this condition is met i need my
// loop to skip the remianing iterations and start with next one.
}
break;
}
}
Update
I think , I was not clear in my question. Say I have 1 to 10 ids in my datatable. Where 7,8,9 have value false and rest true. And this id is too displaying on the checkboxlist. Just my true / false values differs. So What i asked to check the condition and set the value t/f to the checkbox. And the loop will skip once the check box is set to checked.
You can use keyword
continue;as in below codeif you have more question let me know.
Thanks Ankur