.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 10th, 2000, 12:03 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
Simple Question for ASP Pro

<i><b>Originally posted by : Keith Malatesta (malatesta@mediaone.net)</b></i><br />Hello, <br /><br />I am have some difficulty with a script that populated multiple listboxes. The first (Category) works fine, and populates the second (SubCategory) correctly. The problem lies when I select the SubCategory, the form submits but does not return the SubCategory selection. I want the selection to hold, so I can pass the prodsubcatStr via query string.<br /><br />Anyone?<br /><br />Here is my code:<br /><br /><%@ LANGUAGE="VBScript" %><br /><br /></head><br /><br /><body><br /><%<br /> Dim prodCatStr<br /> Dim prodsubcatStr<br /> Dim catRS, subcatRS<br /> Dim Conn, SQLProdCat, SQLProdSubCat<br /> Dim strProduct_ID<br /> <br /> strProduct_ID = Request.QueryString("Product_ID")<br /> <br /> '//*** CONNECT TO STOREFRONT ACCESS DATABASE *** <br /> DSN_Name = Session("DSN_NAME")<br /> Set Conn = Server.CreateObject("ADODB.Connection")<br /> Conn.Open DSN_Name<br /> <br /> '//*** READ FORM PARAMETERS ***<br /> prodCatStr = Request.Form("Category")<br /> prodSubCatStr = Request.Form("ProdCatSubCat")<br /> <br /><br /> '//*** DEFINE ALL SQL QUERIES ***<br /> SQLProdCat = "SELECT DISTINCT ProductCategory FROM ProductCategory" <br /> If prodCatStr <> "" Then <br /> SQLProdSubCat = "SELECT DISTINCT ProductSubCategory FROM ProductCategory " & _<br /> "WHERE ProductCategory.ProductCategory = '" & prodCatStr & "'"<br /> <br /> End If<br />%><br /><br />Please change the Category and SubCategory for product: <br /> <form action="CatSub_update.asp?Product_ID=<%=strProduct_ID%>" Method="POST" name="SelectProdList"><br /><input type="text" name="Product_ID" size="20" value="<%=strProduct_ID%>"><br /><p><br />Product Category <br /> <select name="Category" size="1" onChange="document.forms[0].submit()"><br /> <option value="">All</option><br /><%<br /> '//*** PRODUCT CATEGORY DROP-DOWN LIST BOX *** <br /> Set catRS = Server.CreateObject("ADODB.Recordset") <br /> Set catRS = Conn.Execute(SQLProdCat) <br /> Do While not catRS.EOF<br /> If prodCatStr = catRS("ProductCategory") Then<br /> Response.Write "<option selected "<br /> Else<br /> Response.Write "<option "<br /> End If <br /> Response.Write "value=""" & catRS("ProductCategory") & """>"<br /> Response.Write catRS("ProductCategory") & "</option>"<br /> catRS.MoveNext<br /> Loop<br /> catRS.close<br />%><br /> </select><br /><br><br>SubCategory <br /> <select name="SubCategory" size="1" onChange="document.forms[0].submit()"> <br /> <option value="">All</option><br /><% <br /> '//&&& SubCategory DROP-DOWN LIST BOX ***<br /> If prodCatStr <> "" Then<br /> Set SubCatRS = Server.CreateObject("ADODB.Recordset") <br /> Set SubCatRS = Conn.Execute(SQLProdSubCat) <br /> Do While not SubCatRS.EOF<br /> If ProdSubCatStr = SubCatRS("ProductSubCategory") Then<br /> Response.Write "<option selected "<br /> Else<br /> Response.Write "<option "<br /> End If <br /> Response.Write "value=""" & SubCatRS("ProductSubCategory") & """>"<br /> Response.Write SubCatRS("ProductSubCategory") & "</option>"<br /> SubCatRS.MoveNext<br /> Loop<br /> SubCatRS.close<br /> End if<br />%><br /> </select> <br /></p><br /><p><br /> <a href="catsub_update_resp.asp?Product_ID=<%=strProduct_ID%>Category=<%=ProdCatstr%>SubCategory=<%=prodsubcatStr%>"> Update</a><br /></p><br /></form><br /></body><br /></html><br /><br /><br />

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > Simple Question for ASP Pro


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT