If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Populating a combo based on another combo

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-31-05, 14:32
fidodido fidodido is offline
Registered User
 
Join Date: Jan 2005
Posts: 1
Populating a combo based on another combo

I want to populate a combo that based on another combo.
For example, If i select country from the first combo, the second combo automatically fills with its cities.
Please if anybody can write the code ...
Reply With Quote
  #2 (permalink)  
Old 01-31-05, 16:15
DrewM DrewM is offline
Registered User
 
Join Date: Jan 2005
Posts: 36
You could have a db with 2 tables - one is countries, the other is cities.

In the cities table - have a column 'country' that references the countries table.

On your web page, pull countries from the db, and cities for that country to populate your 2 drop down menu's

Using javascript - onChange the country selector - reload the page with the value of the country sent in a query.

It should be really easy to do it - assuming you have some asp / sql / js knowledge.
Reply With Quote
  #3 (permalink)  
Old 02-01-05, 01:30
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
Perhaps this may hopefully give you some ideas. It's got a downloadable sample and does retain values after the post back:

Classic ASP Design Tips - Dependent Listboxes
http://www.bullschmidt.com/devtip-de...tlistboxes.asp
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On