[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 660
  • Last Modified:

Dependent drop down lists ASP/SQL server

I have to build a three tiers dependent drop down lists populated by 3 tables in an SQL server db. The first field is already populated by a value (date) which should serve as the criteria to query from a second data another set of values (courses) on which would depend in turn the value populating the third drop down. First time I would have to do that. I usually only collect the data, in simple ASP forms, which I export in a spreadsheet to process (statistics). Not a coder here. My file is connected to SQL server via DSN/ODBC. I found a few example but I am swamped. Can someone enlighten me by highlighting a plan of what I should look into to get started on that one.
  • 2
1 Solution
This is a traditional problem with web applications.  There are two different approaches you can take.

First.  You can store all the possible values of all three list boxes and use Javascript to modify the contents of the second and third listboxes as the first and second listboxes change.  The benefits of this method is that the page does not have to be reloaded after each listbox change.  The downside is, a lot of data is sent to the browser that may never be displayed.

Second.  You can reload the page after each listbox change adding a querystring parameter to each load that dictates what the listbox shows.  For example, the first time you load your page, the URL might be mypage.asp?Date=4/5/06 Once a user selects a course, the next call would be mypage.asp?Date=4/5/06&course=ENG101 The benefit of this method is that only the data needed gets sent to the browser.  The drawback is that you have to reload your page.

I think *most* websites choose the Javascript approach.
A while back I wrote a script called Dynamic Multiple Select Lists. That script should address what you are after.
I also have another Multiple Dynamic Form Select script that uses a combination of ASP, JavaScript and AJAX to display the options that may help you solve what you are trying to do: http://www.sorenwinslow.com/MultiSelect.asp

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now