Getting values from an CheckBoxList

R

RSH

Hi,

I have a CheckBoxList that is dynamically created in the codebehind. When I
click the submit button on the form I am handling the click event but I cant
get at the checked values of the checkBoxList.

I have tried:
chList as checkboxlist = findControl("ChkList")
Null exception error...it doesnt exist

I have even resorted to:
Request.Form.Item("ChkList_0")

= nothing



How do i get at the value of a dynamically created checkbox item?



Thanks,

Ron
 
B

bruce barker

you need to add it back in onint in the postback (with the same id).
then in the control you added it to, you can you use findcontrol to find it.

-- bruce (sqlwork.com)
 
R

RSH

Thats what I thought to...but all of the items come back as not selected.

ctrl = FindControl("chkClientAlertPermissions")

For Each item As ListItem In ctrl.Items

System.Diagnostics.Debug.WriteLine(item.Value & " " & item.Selected)

Next



What am I missing here???



Thanks!

Ron
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top