Skip to content

How to populate a select dropdownlist using jQuery and Ajax

Raktimavo Mandal

Asked Aug 1, 2014, 12:33 AM EDT1 answer
Share
LinkedInX
Hi,
I have 2 html dropdown lists labeled namely: Country and City , as given below:
(Note: It has css class associated with it)
 
<select id="Country"  class="dropdown">
<option class="options"></option>
</select>
 
<select id="City"  class="dropdown">
<option class="options"></option>
</select>
 
My Database is in SQL Server. And my development environment is Visual Studio 2010.
My database Details:
Table Name: Country_City
Table view:

Country

City

India Mumbai
India Hyderabad
USA New york   
USA California
 
My objective:
I have to populate Country Dropdownlist from database using jquer-ajax call.Then on selecting a country the respective cities of that country should be visible in the "City" Dropdownlist.
 
Please provide the code for the same.
 
Thanks,

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    steps:
    you're using webform,
            + use updatepanel control
            + place both dropdowns over that
            + at change of country_change() update city dropdown 
    0