473,795 Members | 2,967 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pass dropdown Item to session variable

I am using the code below to open another page depending on what is
selected. This is working ok but I would like to streamline it so that I
will hot have to create a page everytime a new category code is added. How
can I pass the category code to another page as a variable after it is
selected? That way I would only need one page that can be used for all
categories.

Thanks
Carmen

<select name="ListBoxUR L" size="1" language="javas cript"
onchange="gotoL ink(this.form); ">
<option selected>Open Report by Category Code
<%
While not rs.EOF
%>
<option
value="Action_I tems/<%=rs("category _code")%>_start .asp"><%=rs.fie lds("category_c ode")%>
<%
rs.MoveNext
Wend
rs.Close
%>
</select>
</p>
<script language="JavaS cript">
<!--
function gotoLink(form) {
var OptionIndex=for m.ListBoxURL.se lectedIndex;
parent.location = form.ListBoxURL .options[OptionIndex].value;}
//-->
</script>
Jul 22 '05 #1
1 4119
So, wait, you have files named category1_start .asp, category2_start .asp, and
so on?

This is what ASP is meant to overcome. Pass the category ID to your page
and query the data accordingly.

<select onchange="locat ion.href='displ ay.asp?catid='+ this.value;">
<% Do while not.....
<option
value="<%=rs("c ategory_code")% >"><%=rs("categ ory_code")%></option>

And then on display.asp

<%
Dim catID
catID = Request.Queryst ring("catid")
%>

And from there, query your database and get whatever it is you need to
display based on the category ID that was passed.

Ray at work

"carmen" <carmen@iyahoo_ Spam.com> wrote in message
news:Oz******** ********@tk2msf tngp13.phx.gbl. ..
I am using the code below to open another page depending on what is
selected. This is working ok but I would like to streamline it so that I
will hot have to create a page everytime a new category code is added. How
can I pass the category code to another page as a variable after it is
selected? That way I would only need one page that can be used for all
categories.

Thanks
Carmen

<select name="ListBoxUR L" size="1" language="javas cript"
onchange="gotoL ink(this.form); ">
<option selected>Open Report by Category Code
<%
While not rs.EOF
%>
<option
value="Action_I tems/<%=rs("category _code")%>_start .asp"><%=rs.fie lds("catego
ry_code")%> <%
rs.MoveNext
Wend
rs.Close
%>
</select>
</p>
<script language="JavaS cript">
<!--
function gotoLink(form) {
var OptionIndex=for m.ListBoxURL.se lectedIndex;
parent.location = form.ListBoxURL .options[OptionIndex].value;}
//-->
</script>

Jul 22 '05 #2

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

Similar topics

4
11589
by: Gerhard Pretorius | last post by:
ON Win 2003 IIS6, Since yesterday, (12 Aug 2003) for some strange reason, (after installing WindowsServer2003-KB823980-x86-ENU.exe) I cannot pass the Request object to to VB COM DLL. I have a funciton inVB DLL Function BuildSqlWhereFromHTML(ByRef AspReq As ASPTypeLibrary.Request, _ ByRef AspSes As ASPTypeLibrary.Session) As String
6
3469
by: passion_to_be_free | last post by:
This is probably simple, but I can't seem to find it anywhere. I have have some values stored in javascript variables. I have a <select> dropdown list whose options correspond to these values. I want to be able to select an item on the dropdown list based on the value of the javascript variable. Let's say this is my list and my variable: <select id='popup'>
1
4644
by: crjunk | last post by:
I've got an aspx page that allows the user to select different options whenever they want to run a report. On this page, I have added an additional text box for the user to enter in comments about the report they are running. I would like to be able to have the comments that the user has entered to appear on the report that is generated. I thought that I might be able to pass this text to the report by using a session variable but I...
4
1843
by: ruca | last post by:
Hi, How can I pass the values of some variables from page1.aspx to page2.aspx? I try to define some variables in page2 and then when I click a button in page1 it will fill that variables (in page2) with values. The proble is that when I call page2 variable values are NULL. Like this: -------------------------------BEGIN CODE-----------------------------------------------
17
7079
by: Rabbit | last post by:
Hi, On my 1st page, i have a function which gets a new ID value and need to transfer to another immediately. which I want to get in 2nd page using Request.form("txtID"), but doesn't work, the returned value is "" Anybody know how to set this value on 1st page properly, in order to let 2nd page catch it? I don't want to use querystring to pass this value!
6
5857
by: yasodhai | last post by:
Hi, I used a dropdown control which is binded to a datagrid control. I passed the values to the dropdownlist from the database using a function as follows in the aspx itself. <asp:DropDownList ID="FldType_add" Runat="server" DataSource='< %#GetFieldType()%>' DataValueField="Type" DataTextField="Type" /> Oce the page is loaded all the values are added to the dropdown list. But when I thought of getting the selected value from the...
1
2858
SHOverine
by: SHOverine | last post by:
Recently my web host decided to "upgrade". This change rendered many of my pages useless and I am scrambling to fix the issues, so you may see several posts from me in the coming days. My first issue is that all of my dropdown menus are passing the last row to the next page as the session variable. The pages that I am talking about can be found at: Weekly13_Test The code that follows was operational until the change. Here is my...
10
1546
by: Dan | last post by:
Hi, I create 5 dropdownlist in code-behind. I want to insert their selectedvalues in a table by making a string separated with ":" I can get their selecedvalues but i'm stuck when i want to execute the insert. The error is "name dd is not declared" (in line: selvalue = selvalue & Session("dd" & dd.id) & ":" Any idea how to solve this?
3
2787
by: John | last post by:
I have two dropdown lists that I have bound to a datatable and set the DataTextField and DataValueField for. Both lists show the values I expect from the database. However, when I need to access the valueField for a dropdown list I always get the first value. Here is my code I do on load to bind the dropdowns: Try 'load the Division Dropdown dtDiv = objDAL.ExecuteDataTable("GetDivision") With ddDivision
0
9672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10163
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3722
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.