Getting values from an CheckBoxList

  • Thread starter Thread starter RSH
  • Start date Start date
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
 
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)
 
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
 
Back
Top