Click here to Skip to main content
15,920,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I have 3 different dropdownlists (<select> tag) in my webform, now i don't want to use postbacks/codebehind to populate them.The first list pre-populated with the names of countries in the world. Now I want to use web methods (returns json) and jQuery to populate the STATES list based on the country selected (on list.change jQuery event) and so on for the CITY list. Pleas help.

Sampath Lokuge 26-Nov-13 14:14pm    
Check this link :

1 solution

You need to select the dropdown and onchange event u'll need to call a webservice and pu tthe result on the next dropdown. That's it.....for example

$('.ddlCountry').bind('change', function () {
var CountryId = $('.ddlCountry').val();

FillStates = function(CountryId)
url: 'Webservice url', // Webservice gives the states result on the basis of CountryId//
type: 'POST',
cache: false,
dataType: 'json',
data: {CountryId:"'+CountryId+'"},
contentType: 'application/json; charset=utf-8',
success: function (result) {
if (result.d){

Your problem will be solved. Please feel free to ask for any clarifications.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900