Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 25th, 2008, 03:36 PM
Authorized User
 
Join Date: Apr 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default using querystring

Hi programmer gurus!

I an using .asp classics Request.QueryString("Search").

I want to get the query string from my page (variable called "search") and simply have that variable then pass a variable called "open".

I tried:
Request.QueryString("Search") = "open"

and then have <%=Search %> placed in the page near text which I need to say the text "open". ASP is looking for a statement for the request.QueryString.
any ideas??


 
Old March 25th, 2008, 04:45 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

constructivley, you couldnt be further off the mark. You simply can not do this:

Request.QueryString("Search") = "open"

Even if you could, to write a querystring value you need to:

response.write Request.QueryString("Search") OR <%= Request.QueryString("Search") %>

You dont set a querystring value on a page. You send a value from a page to another and use the response object to retrieve it.

Hope that helps, Im not even sure what you are trying to do...

TIP - The line above which I have said isnt allowed would have given you an error. In future post it

Wind is your friend
Matt
www.elitemarquees.com.au
 
Old March 25th, 2008, 06:08 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Matt is quite right and if you think about this logically, what benifit would you gain at run time by placing a value into the query string of the current page? To do this would imply that you already know the value so pushing it up into the query string is a moot point.

I think the issue you are having is a logic question whereby if someone enters your search page and the value of your QueryString is an empty string you want some default text supplied so your app does not crash (or something similiar) is this correct?

If that is the case a simple test against the value can net you that result:

If Request.QueryString("Search") = "" Then
'Do Something
Else
'Do Something Else
End If

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
 
Old March 26th, 2008, 07:55 AM
Authorized User
 
Join Date: Apr 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Let me re-explain my dilemma...

I have a dhtml navigation that is a tree style navigation.
In order to have a specific section stay "open", I need an html tag to say rel="open" inside my <UL> tag.

I want to put an .asp tag inside that <UL> tag so it can change based on the querystring so for example my tag would be set up like this...

<UL rel="<%=LAUNDRYSINKS_WALLMOUNTED %>">

LAUNDRYSINKS_WALLMOUNTEDis my QueryString variable.
So if this matches the querystring, i need that name in this tag to actually say the text "open".
Because the tag to do this function is called rel="open".

So, if I label all my subcategories in my site navigation by its variable, and that particular page passes the querystring that matches, just that tag will say "open" and keep that section opened to view.

Did this make any sense??

 
Old March 26th, 2008, 08:15 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

So you are trying to do a comparison based on the query string value or are you trying to get the key name of the query string to determine the value of your variable?

The key name is the value that exsists in: Request.QueryString(keyName)


================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
 
Old March 26th, 2008, 08:21 AM
Authorized User
 
Join Date: Apr 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I need the keyname to MATCH the same name in my navigation, and then if it matches, i need that tag (<%=LAUNDRYSINKS_WALLMOUNTED %>) to say "open".

Thanks.

 
Old March 26th, 2008, 08:39 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

You need to loop through the collection:

For Each key in Request.QueryString

If key = "somevalue" Then
'Do something
Else
'Do Something Else
End If

Next

If you need to get the value from the querystring during your loop you can do: Request.QueryString(key)

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
 
Old April 1st, 2008, 09:07 AM
Authorized User
 
Join Date: Apr 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks.

I actually resolved the problem by using "CASE". works like a charm!






Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Querystring kaustic Beginning PHP 1 November 2nd, 2007 01:42 AM
Querystring or not? myself Classic ASP Basics 4 July 4th, 2006 09:01 AM
request querystring dannyphw ASP.NET 1.0 and 1.1 Basics 1 October 25th, 2004 10:35 AM
Value in Querystring not being passed u_heet Classic ASP Professional 2 September 16th, 2004 07:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.