Click to See Complete Forum and Search --> : How can we Load a dropdown list from database on selection of another dropdownlist
lrrajesh
06-03-2005, 01:38 AM
I have 3 dropdown boxes, one for country , another for state and another for place. The 3 dropdown list is loaded from 3 tables country, state and place. each tables are linked accordingly.
My problem is...
The country will automatically load at page load (coding done using ASP).
NOw on selection of 'country' i want to load the state dropdown list.Also similarly i want to load the place dropdown list on selection of the 'state'.
can anyone help me for this using javascript or anyother way.
Thanks in advance
Rajesh
maheshwari_a27
06-03-2005, 01:49 AM
What you can do is. at start you fetch all data from database in javascript arrray..according to condition ,then populate your drop down list
lrrajesh
06-03-2005, 02:03 AM
Thanks for your reply,
but how can i use server code in between the select event. i will only get the value of country at the time of selection of first dropdown list
thanks
lunchbox
07-15-2005, 04:34 PM
In the past, I have used a frame to accomplish this. When a item is selected in a select box, the onChange event calls a page in another frame that hits the server, grabs the data from the database and populates the second select box.
We usually set the size of the frame used for the second select box population to 0 so that the user can not see it.
Khalid Ali
07-15-2005, 07:25 PM
Here is the logic that may help u
1. load the page (implies that you get countries from db or wherever)
2. load first menu, user selects one country from list, use onchange event
of select box to submit users selection to the server
3. create another list box populated depending upong the country selected.
follow the same logic when user selects the state for cities