Thursday, March 29, 2012

Set checkboxs to be checked dynamically

hi,
I retrieve checkbox ids from a querystring on a page. Now I need to set the checkboxs to be checked on that page retrieving the ids from the querystring. How do I go about it?

Need some working code please

-vjI tired this...but no luck!!!!


dim ctrl as New HtmlInputCheckBox()
cur_choiceArray = split(request.QueryString("edit_item"), "," )
for i = Lbound(cur_choiceArray) to Ubound(cur_choiceArray)
ctrl = CType(cur_choiceArray(i), HtmlInputCheckBox)
ctrl.Checked=True
next

WHat am i doing wrong here?!
hi rveejay,

you could try like this:

Dim MyControlName As String = Request.QueryString("id")
CType(Me.FindControl(MyControlName), CheckBox).Checked = True

Regards
Richard Bean

0 comments:

Post a Comment