Access selected items' (ListItems) VALUES of dynamically generated CheckBoxList on postBack

B

Boris

When I dynamically create CheckButtonList, I add ListItem(s) to my
CheckButtonList object chkList

chkList.Items.Add(new ListItem("My Text", "My Value"));

The resulting HTML doesn't contain value="My Value". Therefore, I can't
access "My Value" with Request.Form on post back.

I do get the desired outcome with my RadioButtonList object radioList when I
do
radioList.Items.Add(new ListItem("My Text", "My Value"));
because for RadioButtonList, I get "My Value" in html.

How can I make it work for CheckBoxList? What I am trying to achive is to
get the values associated with checked items of my dynamically generated
CheckBoxList through Request.Form. I could do it with RradioButtonList but
not with CheckBoxList. I don't want to have to persist my dynamically
generated CheckBoxList into Session.

Thank you,
-Boris
 
Joined
Sep 30, 2008
Messages
1
Reaction score
0
dynamically generated CheckBoxList value on postback

hi Boris,

Do you manage to get past this issue. I am facing something similar...

thanks
Binu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top