There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Software Development
Tag Cloud
audio blue screen boot bsod computer cpu crash dell desktop driver drivers error excel external hard drive firefox freezes freezing hard drive hardware hijackthis internet internet explorer itunes keyboard laptop malware motherboard mouse network networking outlook outlook 2007 power printer problem ram router screen slow sound trojan usb virtumonde virus vista vista 32-bit windows windows xp winxp wireless
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
asp - session variables for list boxes


Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
dhotrk's Avatar
Junior Member with 26 posts.
 
Join Date: Jan 2004
31-Jan-2004, 09:08 PM #1
asp - session variables for list boxes
Hi,

I am currently trying to create a session variable for the value a user selects from a list box.

I have managed to do this for a text box by using:

<%=Session("strFirstName")%> in the VALUE field of the text box.

I am aware that this will not work in the VALUE portion of a list box but i'm not sure where it should go.

Does any one have any ideas?

Many Thanks!
Ru
Rockn's Avatar
Computer Specs
Distinguished Member with 17,888 posts.
 
Join Date: Jul 2001
Location: Mexico of the North, MN
Experience: Disenfranchised American Male
01-Feb-2004, 10:44 PM #2
Try using label = in the option tag
dhotrk's Avatar
Junior Member with 26 posts.
 
Join Date: Jan 2004
02-Feb-2004, 10:57 PM #3
Hi,

Thanks for your response. Unfortunately it did not work.

I am pretty sure I am doing as you asked - but still no joy.

Do you have any other ideas?

Thanks

***************************
<SELECT NAME=strFrmTitle>
<OPTION label = "<%=Session("strTitle")%>" VALUE="Mr"SELECTED>Mr
<OPTION label = "<%=Session("strTitle")%>" VALUE="Mrs">Mrs
<OPTION label = "<%=Session("strTitle")%>" VALUE="Ms">Ms
<OPTION label = "<%=Session("strTitle")%>" VALUE="Mst">Mst
<OPTION label = "<%=Session("strTitle")%>" VALUE="Other">Other
</SELECT>

*******************
'Create session variables for each of the user input details
Session("strTitle") = Request("strFrmTitle")
Rockn's Avatar
Computer Specs
Distinguished Member with 17,888 posts.
 
Join Date: Jul 2001
Location: Mexico of the North, MN
Experience: Disenfranchised American Male
03-Feb-2004, 04:52 PM #4
Value= "<%=Session("strTitle")%>" and you will have to do a conditional check to see if a session variable has been set for strTitle or the entire list should be displayed.
dhotrk's Avatar
Junior Member with 26 posts.
 
Join Date: Jan 2004
03-Feb-2004, 09:13 PM #5
Hi Rockn

I've tried what you suggested but i still cannot seem to get it to work - am i doing something wrong?

Do you have any other ideas .... Please?!?

Thank you.


My listbox code looks like this

<SELECT NAME=strFrmTitle>
<OPTION VALUE="<%=Session("strTitle")%>" SELECTED>Mr
<OPTION VALUE="<%=Session("strTitle")%>">Mrs
<OPTION VALUE="<%=Session("strTitle")%>">Ms
<OPTION VALUE="<%=Session("strTitle")%>">Mst
<OPTION VALUE="<%=Session("strTitle")%>">Other
</SELECT>


And I (attempt to!) create my session variables like this:

strTitle = Request("strFrmTitle")

if strTitle = "Mr" then
Session("strTitle") = "Mr"
elseif strTitle = "Mrs" then
Session("strTitle") = "Mrs"
elseif strTitle = "Ms" then
Session("strTitle") = "Ms"
elseif strTitle = "Mst" then
Session("strTitle") = "Mst"
elseif strTitle = "Other" then
Session("strTitle") = "Other"
end if
Centurix's Avatar
Junior Member with 1 posts.
 
Join Date: Feb 2004
08-Feb-2004, 11:23 AM #6
<SELECT NAME=strFrmTitle>
<%if Session("strTitle")="Mr" then sSel="selected" else sSel=""%>
<OPTION <%=sSel%>>Mr
<%if Session("strTitle")="Mrs" then sSel="selected" else sSel=""%>
<OPTION <%=sSel%>>Mrs
<%if Session("strTitle")="Ms" then sSel="selected" else sSel=""%>
<OPTION <%=sSel%>>Ms
<%if Session("strTitle")="Mst" then sSel="selected" else sSel=""%>
<OPTION <%=sSel%>>Mst
<%if Session("strTitle")="Other" then sSel="selected" else sSel=""%>
<OPTION <%=sSel%>>Other
</SELECT>

-------------------------------------

Session("strTitle") = Request("strFrmTitle")
dhotrk's Avatar
Junior Member with 26 posts.
 
Join Date: Jan 2004
08-Feb-2004, 05:56 PM #7
Thank you so much Centurix!!!

You don't know how long i've been trying to figure that one out. It looks so simple now!

Thanks again.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:26 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.