G
Guest
How can I check which items has been selected in CheckBoxList control when I bind data to it from SQL Server? The code I use works fine when I add manually items into checkboxlist control, but does not work when I bind it.
String s = "Selected items:<br>"
for (int i=0; i < CheckBoxList1.Items.Count; i++)
if ( CheckBoxList1.Items[ i ].Selected )
// List the selected item
s = s + CheckBoxList1.Items.Text
s = s + "<br>"
}
String s = "Selected items:<br>"
for (int i=0; i < CheckBoxList1.Items.Count; i++)
if ( CheckBoxList1.Items[ i ].Selected )
// List the selected item
s = s + CheckBoxList1.Items.Text
s = s + "<br>"
}