Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Pass dropdown Item to session variable

Reply
Thread Tools

Pass dropdown Item to session variable

 
 
carmen
Guest
Posts: n/a
 
      04-18-2005
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="ListBoxURL" size="1" language="javascript"
onchange="gotoLink(this.form);">
<option selected>Open Report by Category Code
<%
While not rs.EOF
%>
<option
value="Action_Items/<%=rs("category_code")%>_start.asp"><%=rs.fields(" category_code")%>
<%
rs.MoveNext
Wend
rs.Close
%>
</select>
</p>
<script language="JavaScript">
<!--
function gotoLink(form) {
var OptionIndex=form.ListBoxURL.selectedIndex;
parent.location = form.ListBoxURL.options[OptionIndex].value;}
//-->
</script>


 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      04-18-2005
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="location.href='display.asp?catid='+this. value;">
<% Do while not.....
<option
value="<%=rs("category_code")%>"><%=rs("category_c ode")%></option>

And then on display.asp

<%
Dim catID
catID = Request.Querystring("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%(E-Mail Removed)...
> 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="ListBoxURL" size="1" language="javascript"
> onchange="gotoLink(this.form);">
> <option selected>Open Report by Category Code
> <%
> While not rs.EOF
> %>
> <option
>

value="Action_Items/<%=rs("category_code")%>_start.asp"><%=rs.fields(" catego
ry_code")%>
> <%
> rs.MoveNext
> Wend
> rs.Close
> %>
> </select>
> </p>
> <script language="JavaScript">
> <!--
> function gotoLink(form) {
> var OptionIndex=form.ListBoxURL.selectedIndex;
> parent.location = form.ListBoxURL.options[OptionIndex].value;}
> //-->
> </script>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Variable Input on procedure - pass by value or pass by reference? Tricky VHDL 0 03-19-2009 03:59 PM
Variable Input on procedure - pass by value or pass by reference? Tricky VHDL 0 03-19-2009 03:58 PM
System Session Variable VS. Own-declared 'Session' Variable chowchho ASP .Net 7 03-28-2008 02:38 PM
dropdown variable pass as URL parameters Cathy Javascript 0 07-02-2007 11:07 PM
Retrieving the selected item from the dropdown list and storing it in a local variable yasodhai@gmail.com ASP .Net 6 03-08-2007 11:52 AM



Advertisments