I’d like to build a query string based on values taken from 5 groups of radio buttons.
Selecting any of the groups is optional so you could pick set A or B or both. How would I build the querystring based on this? I’m using VB.NET 1.1
The asp:Radiobuttonlist control does not like null values so I’m resorting to normal html radio buttons. My question is how do I string up the selected values into a querystring
I have something like this right now:
HTML:
<input type='radio' name='apBoat' id='Apb1' value='1' /> detail1 <input type='radio' name='apBoat' id='Apb2' value='2' /> detail2 <input type='radio' name='cBoat' id='Cb1' value='1' /> detail1 <input type='radio' name='cBoat' id='Cb2' value='2' /> detail2
VB.NET
Public Sub btnSubmit_click(ByVal sender As Object, ByVal e As System.EventArgs) Dim queryString As String = 'nextpage.aspx?' Dim aBoat, bBoat, cBoat bas String aBoat = 'apb=' & Request('aBoat') bBoat = 'bBoat=' & Request('bBoat') cBoat = 'cBoat=' & Request('cBoat ') queryString += aBoat & bBoat & cBoat Response.Redirect(queryString) End Sub
Is this the best way to build the query string or should I take a different approach altogether? Appreciate all the help I can get. Thanks much.
The easiest way would be to use a non-server-side <form> tag with the method=’get’ then when the form was submitted you would automatically get the querystring you are after (and don’t forget to add <label> tags and associate them with your radio buttons):