Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Passing variable through a URL
Old 01-14-2005, 11:18 PM Passing variable through a URL
Junior Talker

Posts: 2
Trades: 0
Hi all.

I have been trying to find an answer on this through google, but nothing seems to be showing up.

What I have is some records being displayed in a table, and at the top are some links that will order the results by date, author etc. I have the ORDER BY statement setup so that it is looking at the URL for the value.

The problem is that the two pieces of information I need to pass through the URL is the order (which I can do by having page,asp?Order=Author), and the current page that the user is on so that it knows where to go after clicking the link. The problem is that I have the current page location setup as a variable (well, more or less it tells the database what table to get), but I don’t know how to pass that to the URL. If I type 'page,asp?Order=Author&Cat=nID' (nID being the variable which defines which table to show) then it will pass the words nID to the new page. I need to get the VALUE of nID so that the url will look like 'page,asp?Order=Author&Cat=1'. In coldfusion you used to put it something like 'age,asp?Order=Author&Cat=#nID#' so that the page knew it was a value instead, but I have no idea how to do this with ASP.

Sorry for the long and confusing explanation. If someone can help me with this, I would appreciate it very much
fubar is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-15-2005, 01:41 AM
Junior Talker

Posts: 2
Trades: 0
You know, this is just my luck. For months now I have been trying to figure this out, and never got around to asking on a forum. I FINALLY find a good forum and write up a post, and a mere 10 minutes later I find the answer halfway through 20 paragraphs of mind boggling code on some random site.

In case anyone else is wondering how to do this, the URL should look like:


index.asp?cat=<%=vaiable_to_pass%>
fubar is offline
Reply With Quote
View Public Profile
 
Old 01-17-2005, 10:53 PM
Bullschmidt's Avatar
Average Talker

Posts: 24
Location: USA
Trades: 0
And perhaps use Server.URLEncode() in case the field may contain any odd characters:

index.asp?cat=<%= Server.URLEncode(vaiable_to_pass) %>
__________________
J. Paul Schmidt

Please login or register to view this content. Registration is FREE
- Freelance Web and Database Developer

Please login or register to view this content. Registration is FREE
- Classic ASP Design Tips
Bullschmidt is offline
Reply With Quote
View Public Profile Visit Bullschmidt's homepage!
 
Reply     « Reply to Passing variable through a URL
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12868 seconds with 12 queries