Showing posts with label querystring. Show all posts
Showing posts with label querystring. Show all posts

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

Tuesday, March 13, 2012

Set Select Control's Value from Querystring

This is probably very easy.
How do I set an HTML select control's value from the querystring?
This is what I have...but, only the select control's value doesn't get
set.
CustomerSelect.Value = Request.QueryString("cus")
StartDate.Text = Request.QueryString("Sdate")
This works...
StartDate.Text = Request.QueryString("cus")
Thanks,
j.t.wIf you just want a dropdown, consider the server controls rather than HTML
controls and then set selected value to the key value you wish. I can look
at the HTML control and probably guide there, but the server controls are
fairly straightforward.
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
****************************************
*********
| Think outside the box!
|
****************************************
*********
"j.t.w" <j.t.w@.juno.com> wrote in message
news:a9a2e312-6182-45b3-83b5-5298b955a785@.q78g2000hsh.googlegroups.com...
> This is probably very easy.
> How do I set an HTML select control's value from the querystring?
> This is what I have...but, only the select control's value doesn't get
> set.
> CustomerSelect.Value = Request.QueryString("cus")
> StartDate.Text = Request.QueryString("Sdate")
> This works...
> StartDate.Text = Request.QueryString("cus")
> Thanks,
> j.t.w
Try setting the SelectedValue or SelectedText properties.
"j.t.w" <j.t.w@.juno.com> wrote in message
news:a9a2e312-6182-45b3-83b5-5298b955a785@.q78g2000hsh.googlegroups.com...
> This is probably very easy.
> How do I set an HTML select control's value from the querystring?
> This is what I have...but, only the select control's value doesn't get
> set.
> CustomerSelect.Value = Request.QueryString("cus")
> StartDate.Text = Request.QueryString("Sdate")
> This works...
> StartDate.Text = Request.QueryString("cus")
> Thanks,
> j.t.w
>