Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting all QueryStrings for other links on page.. 1

Status
Not open for further replies.

snowboardr

Programmer
Feb 22, 2002
1,401
PH
Im am trying to get all QueryStrings and QueryParameter and put them into links on the page, so if a user changes a combo box all queryStrings stay in place. I have attempted this:

Function GetAllQ()
FOR EACH QueryString_Parameter IN Request.QueryString
Response.Write(QueryString_Parameter & "=") & Request.QueryString(QueryString_Parameter) & "&"
NEXT
End function

Is there a way to put all the QueryStrings and the parameter into a string so in my link I can just put the string in and any other QueryStrings I need to add to it?

I have tried putting

<%= ScriptName & &quot;?&quot; & GetAllQ()& bla bla, it doesnt work because i have to have Response.write in both places...so it errors ofcourse..

Thanks for any help on this question.



-Jason
 
Hi

If you put your response.write code in brackets it will execute your expression, then write the result.

<%=(scriptname & &quot;?&quot; & getallQ() )%> Derren
[The only person in the world to like Word]
 
I tried
Function GetAll..

QueryString_Parameter & &quot;=&quot;) & Request.QueryString(QueryString_Parameter) & &quot;&&quot;

En..
But you have to have something to the left of it or no?
 
Sorry, forgot to mention that &quot;request.querystring&quot; on its own gives you the whole querystring, not just an element of it!

Try using

Code:
<%=(scriptname & &quot;?&quot; & request.querystring)%>

That'll serve you better! Derren
[The only person in the world to like Word]
 
Oh dude, that was just to easy Thanks for tip man!!!

- Jason
 
Shoot problem though, If they click a link with the same querystring and different values it gives double querystrings...

view=1&view=2

[neutral]
 
Hmmm, therein lies the rub ... You should not have said &quot;too easy&quot;!

This may work, but with a bit more code... and you'll have to be careful with the names of your querystrings

Code:
replace(response.querystring,&quot;view=&quot; & request.querystring(&quot;view&quot;),&quot;view=&quot; & newvalue)

instead of just response.querystring. Basically, if you find the url parameter you are appending within the current querystring then we replace the name of the urlparam + the current value with the urlparam + the new value.

I hope that makes sense! Derren
[The only person in the world to like Word]
 
Dude, I dunno I gave up on that one, it turned out to take more type then updating all my links that had this:

<%= scriptname & &quot;?order_by=&quot; & Request.QueryString(&quot;order_by&quot;) & &quot;&order=&quot; & Request.QueryString(&quot;order&quot;) & &quot;&show=&quot; & Request.QueryString(&quot;show&quot;) & &quot;&p=&quot; & Request.QueryString(&quot;p&quot;) & &quot;&mark=3&quot; & &quot;&page=&quot; & Request.QueryString(&quot;page&quot;) %>

lol
Maybe someday an easy way to do that will come to be. eh
 
ok its 5 am I can't type haha to much programming this month!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top