Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 4th, 2005, 11:19 AM
Registered User
 
Join Date: Aug 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Load two variables into Dropdown list

I have an asp dropdown list that I would like to populate dynamically with two fields. One field should hold 'CourseID', the other, 'Course'. I want the user to select a course by it's description. Then I want to use the dropdown selected CourseID value to pass to a local asp page variable that I will then pass to another asp form for updating a record.

So:

1) How do I load the dropdown with two values from my recordset.
2) How do I retrieve the CourseID value the user selects, using the 'onChange' property.

Thanks if any can help.

Kevin

My working data select statement:
rsStudentClasses.Source = "SELECT C.Course_Id, C.Course_No + ' ' + C.Section + ' ' + C.Area" & _
                    " + ' ' + C.Short_Description AS Course FROM StudentCourseList S " & _
                    " INNER JOIN Course_Info C ON C.Course_Id = S.Course_Id" & _
                    " WHERE S.Student_Id = '" & StudentID & "' ORDER BY Course"

================================================== ============
Current working code to populate the droplown list:

<select name="select" >

<option value="value"

     <%
     If (Not isNull((rsStudentClasses.Fields.Item("Course").Val ue))) Then If ("value" = CStr((rsStudentClasses.Fields.Item("Course").Value ))) Then Response.Write("SELECTED") : Response.Write("")%>>&nbsp;

</option>

<%
 While (NOT rsStudentClasses.EOF)
%>

<option value="<%=rsStudentClasses("Course_Id").Value%>">< %=rsStudentClasses("Course").Value%></option>

<%
     rsStudentClasses.MoveNext()
     Wend

     If (rsStudentClasses.CursorType > 0) Then
          rsStudentClasses.MoveFirst
     Else
          rsStudentClasses.Requery
     End If
%>

</select>

 
Old August 10th, 2005, 06:14 PM
Authorized User
 
Join Date: Aug 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i am working on the same thing.
all i can tell you is that there is no way to do this completely in asp or in javascript. you have to use both.
these links might help

http://www.atgconsulting.com/doublelist.asp
http://www.atgconsulting.com/triplelist.asp
http://www.atgconsulting.com/oodynlistbox.asp
http://www.atgconsulting.com/dotnetlinkedlistbox.aspx
http://www.learnasp.com/learn/subjectdropdowns.asp

this is a really hard yet common problem so if i get a working script, i'll post to this topic.
you can find tons of info on this subject by searching for "dynamically linked listboxes" online.

good luck

-----------------------------------------
Inigo: You have a great gift for rhyme.
Fezzik: Yes, yes, some of the time.
Vizzini: Enough of that.
Inigo: Fezzik, are there rocks ahead?
Fezzik: If there are, we'll all be dead.
Vizzini: No more rhymes now, I mean it!
Fezzik: Anybody want a peanut?
 
Old August 12th, 2005, 09:25 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii tryntolearn!!
please visit the link

http://p2p.wrox.com/topic.asp?TOPIC_ID=31530

Hope this will help you

Cheers :)

vinod





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dropdown list maha .NET Framework 2.0 7 April 28th, 2007 12:32 AM
fill dropdown list with items when parent list isaac_cm Pro PHP 1 July 10th, 2006 05:41 AM
how to load specific value from dropdown list? method ASP.NET 1.0 and 1.1 Basics 1 June 17th, 2005 08:08 AM
dropdown list not selecting record on page load whyulil ASP.NET 1.0 and 1.1 Basics 1 September 8th, 2004 08:29 AM
HELP WITH DROPDOWN LIST enavas Excel VBA 1 April 6th, 2004 02:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.