473,405 Members | 2,185 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,405 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 4730
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...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.