View Full Version : two combo boxes

01-03-2007, 09:58 AM
Im a newbie, my problem is to create two combo whrere the values in the second depend from first, and both combo are loaded by datas of database sql server, to load the first is easy, so on event onchange Id like to load second combo by a query from db.
Any ideas?

regards ENzo

01-03-2007, 11:51 AM
This is a fairly common request. In fact, a cursory Google for "ASP+populate+second+dropdown (http://www.google.co.uk/search?q=ASP+populate+second+dropdown)" would have given you a whole load of possible solutions. Or the same search on this forum gives you several threads where the issue is discussed in detail. But basically, you can submit your form to itself and requery the data each time, you can load the whole lot into client-side arrays, or you can do it the bling way with Ajax. You seem happy with getting data out of a database, and you're clearly familiar with enough client-side scripting: which aspect of populating the second drop-down are you having difficulty with?

01-03-2007, 12:20 PM
tks, for reply, so really im working with asp.net so far, its first time with asp, anyway my first difficult its to pass the parameter selected in first combo to stored procedure for second combo, i dont know how i can get it and pass to second combo...

thks Enzo

01-03-2007, 02:41 PM
If you're using ASP.NET I would suggest you to use Cascading DropDown control in Ajax.Net.

01-03-2007, 04:49 PM
unfortunately now I must use asp :( , anyway ive had a good help from link suggested from you, thanks


01-12-2007, 04:15 PM
Here is an example of a Pure ASP/HTML dependent dropdown

It also include Ajax code so that if javascript is enabled the menu is dynamic (onchange)