473,372 Members | 734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

Set Session Variable and Redirect

I have a list of items drawn from a SQL DB and listed on an ASP page. This
works fine.

How can I make it so that when a user clicks a particular item, a session
variable is set to the ID of the item and the user redirected to another
page?

Thanks
Jul 19 '05 #1
7 4727
link to the page you're on, with the id in the querystring. at the top
of the page, check for the querystring id, if <> "" then set the session
var and response.redirect to the next page.

for a bit more security, you could create a hidden form pointing to the
page you're on, set to post (so the id won't be in the querystring), and
have the link be javascript that changes the value of the id field to
that item's id and submits the form.

"Keith" <@.> wrote in message
news:#d**************@TK2MSFTNGP09.phx.gbl...
I have a list of items drawn from a SQL DB and listed on an ASP page. This works fine.

How can I make it so that when a user clicks a particular item, a session variable is set to the ID of the item and the user redirected to another page?

Jul 19 '05 #2
are you trying to do this clientside or serverside?

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Keith" <@.> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
I have a list of items drawn from a SQL DB and listed on an ASP page. This works fine.

How can I make it so that when a user clicks a particular item, a session
variable is set to the ID of the item and the user redirected to another
page?

Thanks

Jul 19 '05 #3
Would prefer server side but client side would work too

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
are you trying to do this clientside or serverside?

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Keith" <@.> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
I have a list of items drawn from a SQL DB and listed on an ASP page.

This
works fine.

How can I make it so that when a user clicks a particular item, a session variable is set to the ID of the item and the user redirected to another
page?

Thanks


Jul 19 '05 #4
just catch the POST and take the textbox value and put it in a Session
variable as you normally would, then redirect.

Session("MyVal") = Request.Form("textbox1")
Response.Redirect("yourpage.asp")

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Keith" <@.> wrote in message news:eT**************@tk2msftngp13.phx.gbl...
Would prefer server side but client side would work too

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
are you trying to do this clientside or serverside?

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Keith" <@.> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
I have a list of items drawn from a SQL DB and listed on an ASP page.

This
works fine.

How can I make it so that when a user clicks a particular item, a session variable is set to the ID of the item and the user redirected to another page?

Thanks



Jul 19 '05 #5
Thanks

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:er****************@TK2MSFTNGP11.phx.gbl...
just catch the POST and take the textbox value and put it in a Session
variable as you normally would, then redirect.

Session("MyVal") = Request.Form("textbox1")
Response.Redirect("yourpage.asp")

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Keith" <@.> wrote in message

news:eT**************@tk2msftngp13.phx.gbl...
Would prefer server side but client side would work too

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
are you trying to do this clientside or serverside?

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Keith" <@.> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
> I have a list of items drawn from a SQL DB and listed on an ASP page. This
> works fine.
>
> How can I make it so that when a user clicks a particular item, a

session
> variable is set to the ID of the item and the user redirected to another > page?
>
> Thanks
>
>



Jul 19 '05 #6
http://www.gatewayorlando.com/conten...yRateSheet.asp

Features a list of destinations which when clicked will load a several
session variables and then redirect to a reservation request form. This
particular example uses a JavaScript function tied to the onClick event
for each TR.

onClick="trOnClick('38','20');"

function trOnClick(orgKey, destKey)
{
document.frmResortRateSheet.dropOffLocation.value = _
document.getElementById('destText' + destKey).innerHTML;

document.frmResortRateSheet.action = _
'../processingScripts/reservationRequestV3_loadTransfer.asp?org=' +
orgKey + '&dest=' + destKey;

document.frmResortRateSheet.submit();
}

The example above involves a form and changing the form's action before
submitting the form using code. An alternative would be to simply call
the page directly.

function trOnClick(destKey)
{
window.location.href='../processingScripts/rateQuoteSearch_setLocation.asp?location='
+ destKey
}

You could of course just set the onClick event to "window.location.href...".

David H
www.gatewayorlando.com

Keith wrote:
I have a list of items drawn from a SQL DB and listed on an ASP page. This
works fine.

How can I make it so that when a user clicks a particular item, a session
variable is set to the ID of the item and the user redirected to another
page?

Thanks


Jul 19 '05 #7
The ASP page called in my examples looks something like this

<% session("variableName") = "hello world"
response.redirect ("../content/reservationRequestV3_submit.asp")%>

Keith wrote:
I have a list of items drawn from a SQL DB and listed on an ASP page. This
works fine.

How can I make it so that when a user clicks a particular item, a session
variable is set to the ID of the item and the user redirected to another
page?

Thanks


Jul 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Keith | last post by:
Is there any way of detecting whether a session variable does not exist because it expired or because it simply did not exist in the first place? Thanks
6
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an...
1
by: Scott Wickham | last post by:
I'm having a problem saving session information on one form and retrieving it on a subsequent form...for only one out of a number of users. Actually, I'm not absolutely certain it's a session...
1
by: farooqazeem | last post by:
Hi guys, I’m facing some problem can u solve it. Problem is: I’m giving user Id and password in (Login_sess.asp) and submit it to page (sess_test.asp). I am setting session variable...
9
by: Greg Linwood | last post by:
I'm having difficulty understanding Session state in ASP.Net. It's almost embarrassing asking this as I've been using ASP since it was first released & it really shouldn't be this hard to use -...
1
by: John | last post by:
Hi, I have a routine that sets some session variables and then redirects the user to another page in the same application/ same folder. ======= Session("MyName") = "Fredsmith"...
6
by: Mike | last post by:
I have a function that is called when the user clicks the submit button, during this function i also set a varaible to "Y" due to that this function does a post back to the page then redirects....
7
by: Lucas Tam | last post by:
I'm calling the session object from an inherited page. The page is based off an herited class which outputs XML. Does anyone know why the session object would be nothing? ...
6
by: JJ_377 | last post by:
In a "Save and Quit" button on my web app form (aspx), I have the following code that is supposed to clear a session variable (an user id) and redirect to a logon page: Session.Clear()...
14
by: Coleen | last post by:
Hi All :-) We have an APSX application using VB.net as the code behind, which uses one or two session variables per page. These Session variables are passed to the final page and calculations...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.