updating query string on client

D

Dennis

I'm sure there is an easy way to do what I want but I'm failing to find
it...


I have a single web page with links back to itself with set query
strings...


href="?data=x"
href="?data=y"
href="?data=z"


This works fine...

The problem is that now I need to update/add to the query string based on
selection of radio buttons on the page. Since the href above drives
"page_load" all values are set to default...

Is there a way to append to the href with more data on the client side?
such as add a variable that is updated on the page based on the radio
button selected? Then passed when they select the link? I'm sure this is
something easy but what i have tried has failed...

Thank you
 
S

Siva M

Here is one way:

<html>
....
<script>
function addQS()
{
var qs;
// Construct the query string based on radio buttons and assign in to qs
window.location.href = <current page> + "?" + qs;
}
</script>
<body onunload="addQS();">
....

I'm sure there is an easy way to do what I want but I'm failing to find
it...


I have a single web page with links back to itself with set query
strings...


href="?data=x"
href="?data=y"
href="?data=z"


This works fine...

The problem is that now I need to update/add to the query string based on
selection of radio buttons on the page. Since the href above drives
"page_load" all values are set to default...

Is there a way to append to the href with more data on the client side?
such as add a variable that is updated on the page based on the radio
button selected? Then passed when they select the link? I'm sure this is
something easy but what i have tried has failed...

Thank you
 
D

Dennis

Not sure what you want to see...most of the code is creating data for
Gridview that displays upons selection of one of the links...


This is the basics:


Partial Class Default2
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim theData As String

theData = Request.QueryString("data")
If Not theData = Nothing Then
.
.
.
blah blah blach
.
.
.
If RadioButton2.Checked Then
filter = "Warn"
ElseIf RadioButton3.Checked Then
filter = "Watch"
ElseIf RadioButton4.Checked Then
filter = "Advis"
Else
filter = ""
End If
For Each xNode In xNodeList

...Do some stuff....

Next

GridView1.DataSource = newDataSet
GridView1.DataBind()


End If
End Sub
End Class

When I look at the RadioButtons they are always unvalued..so I get the
default...what I was thinking is i could add more data to querystring
based on the selection..

Thank you...hope this answers your question.
 
D

Dennis

Thank you

I just have a question about the <current page> part...

Is this a variable? ie. i code "<current page>" in the code...

Or are you saying to value this with the current page?

If this is a variable that i can use....will this have the HREF from the
link they have selected and then append the data i code to it?

The problem is that they click on one of several links (there actually
50 of these - so 50 values of x.

<current page>?data=x

I need to then add item to the querystring

<current page>?data=x,moredata=y

and moredata is based on the radio button...

I want to avoid putting this all in script if I can...

Thanks

I hope this makes sense and I haven't confused the issue...
 
S

Siva M

<currrent page> I meant as a placeholder for the current page's name.

Thank you

I just have a question about the <current page> part...

Is this a variable? ie. i code "<current page>" in the code...

Or are you saying to value this with the current page?

If this is a variable that i can use....will this have the HREF from the
link they have selected and then append the data i code to it?

The problem is that they click on one of several links (there actually
50 of these - so 50 values of x.

<current page>?data=x

I need to then add item to the querystring

<current page>?data=x,moredata=y

and moredata is based on the radio button...

I want to avoid putting this all in script if I can...

Thanks

I hope this makes sense and I haven't confused the issue...
 

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,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top