CheckBoxList contorl's selected items, problem

  • Thread starter Thread starter Guest
  • Start date Start date
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>"
}
 
Sorry, my fault, I forgot to put if (IsPostBack==false) in PageLoad(). I got it work now :-)
 
Back
Top