How to get values from dynamically generated CheckBoxList?

sugunsg used Ask the Experts™
In aspx(C#) page I am generating dynamic CheckBoxList. The CheckBoxLists are generated successfully. In server code I need to get the seleted values from Selected CheckBox. How to do this?

I am generating 3 CheckBoxList like CHKL_1,CHKL_2,CHKL_3.
By progrmatically Check boxes are added using DataBound method of CheckBoxList.
Each CheckBoxList have diff no.of CheCkBox items. I need all the selected check box values from all 3 CheckBoxList.

Any one help me!

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
try this:

foreach (ListItem item in CHKL_1.Items)
     if (item.Selected)
          //do stuff
          //item.Value has the string value of the checked

for your 3 lists.


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial