Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 727387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:33:42+00:00 2026-05-14T06:33:42+00:00

I am developing a country state cascading dropdown list… I returned JSON result based

  • 0

I am developing a country state cascading dropdown list… I returned JSON result based on countryId but I don’t know how to populate/fill it in a new dropdown listbox…

Here is what I am using,

function getstate(countryId) {
    $.ajax({
        type: "POST",
        url: "Reg_Form.aspx/Getstates",
        data: "{'countryId':" + (countryId) + "}",
        contentType: "application/json; charset=utf-8",
        global: false,
        async: false,
        dataType: "json",
        success: function(jsonObj) {
            alert(jsonObj.d);
        }
    });
    return false;
}

And alert gave this,

{"Table" : [{"stateid" : "2","statename" : "Tamilnadu"},
            {"stateid" : "3","statename" : "Karnataka"},
            {"stateid" : "4","statename" : "Andaman and Nicobar"},
             {"stateid" : "5","statename" : "Andhra Pradesh"},
             {"stateid" : "6","statename" : "Arunachal Pradesh"}]}

And my aspx page has this,

<td>
<asp:DropDownList ID="DLCountry" runat="server" CssClass="dropDownListSkin" 
 onchange="return getstate(this.value);">
 </asp:DropDownList>
  </td>
 <td>
 <asp:DropDownList ID="DLState" runat="server" CssClass="dropDownListSkin">
   </asp:DropDownList>
 </td>

Any suggestion on how to fill DLState dropdown…

EDIT:

When I inspected through firebug I got the response for my AJAX post,

{"d":"{\"Table\" : [{\"stateid\" : \"2\",\"statename\" : \"Tamilnadu\"},{\"stateid\" : \"3\",\"statename\" : \"Karnataka\"},{\"stateid\" : \"4\",\"statename\" : \"Andaman and Nicobar\"},{\"stateid\" : \"5\",\"statename\" : \"Andhra Pradesh\"},{\"stateid\" : \"6\",\"statename\" : \"Arunachal Pradesh\"},{\"stateid\" : \"7\",\"statename\" : \"Assam\"},{\"stateid\" : \"8\",\"statename\" : \"Bihar\"},{\"stateid\" : \"9\",\"statename\" : \"Dadra and N. Haveli\"},{\"stateid\" : \"10\",\"statename\" : \"Daman and Diu\"},{\"stateid\" : \"11\",\"statename\" : \"Delhi\"},{\"stateid\" : \"12\",\"statename\" : \"Goa\"},{\"stateid\" : \"13\",\"statename\" : \"Gujarat\"},{\"stateid\" : \"14\",\"statename\" : \"Haryana\"},{\"stateid\" : \"15\",\"statename\" : \"Himachal Pradesh\"},{\"stateid\" : \"16\",\"statename\" : \"Jammu and Kashmir\"},{\"stateid\" : \"17\",\"statename\" : \"Kerala\"},{\"stateid\" : \"18\",\"statename\" : \"Laccadive Islands\"},{\"stateid\" : \"19\",\"statename\" : \"Madhya Pradesh\"},{\"stateid\" : \"20\",\"statename\" : \"Maharashtra\"},{\"stateid\" : \"21\",\"statename\" : \"Manipur\"},{\"stateid\" : \"22\",\"statename\" : \"Meghalaya\"},{\"stateid\" : \"23\",\"statename\" : \"Mizoram\"},{\"stateid\" : \"24\",\"statename\" : \"Nagaland\"},{\"stateid\" : \"25\",\"statename\" : \"Orissa\"},{\"stateid\" : \"26\",\"statename\" : \"Pondicherry\"},{\"stateid\" : \"27\",\"statename\" : \"Punjab\"},{\"stateid\" : \"28\",\"statename\" : \"Rajasthan\"},{\"stateid\" : \"29\",\"statename\" : \"Sikkim\"},{\"stateid\" : \"30\",\"statename\" : \"Tripura\"},{\"stateid\" : \"31\",\"statename\" : \"Uttar Pradesh\"},{\"stateid\" : \"32\",\"statename\" : \"West Bengal\"}]}"}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:33:43+00:00Added an answer on May 14, 2026 at 6:33 am
    var listItems= "";
    var jsonData = jsonObj.d;
        for (var i = 0; i < jsonData.Table.length; i++){
          listItems+= "<option value='" + jsonData.Table[i].stateid + "'>" + jsonData.Table[i].statename + "</option>";
        }
        $("#<%=DLState.ClientID%>").html(listItems);
    

    Example

       <html>
        <head></head>
        <body>
          <select id="DLState">
          </select>
        </body>
        </html>
    
        /*javascript*/
        var jsonList = {"Table" : [{"stateid" : "2","statename" : "Tamilnadu"},
                    {"stateid" : "3","statename" : "Karnataka"},
                    {"stateid" : "4","statename" : "Andaman and Nicobar"},
                     {"stateid" : "5","statename" : "Andhra Pradesh"},
                     {"stateid" : "6","statename" : "Arunachal Pradesh"}]}
    
        $(document).ready(function(){
          var listItems= "";
          for (var i = 0; i < jsonList.Table.length; i++){
            listItems+= "<option value='" + jsonList.Table[i].stateid + "'>" + jsonList.Table[i].statename + "</option>";
          }
          $("#DLState").html(listItems);
        });    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing application that can be useful only in my country(Ukraine). In Ukraine people
This is the scenario i have: im developing a web app that will list
Developing an app where all tabular data is returned as an object. Some cells
We’re developing an iOS app. One requirement we have is, get the country of
i am developing a PHP/MYSQL search module, where i have to search tables based
Developing a heavily XML-based Java-application, I recently encountered an interesting problem on Ubuntu Linux.
i am developing a website using asp.net 3.5.i have created a cascading dropdownlist for
I am developing a multi-country and multi-lingual website using Drupal. I am relatively new
I'm developing some software that will be used in multiple instances across the country.
HTTP Post may have multiple params such as: http://example.com/controller/ (while params=({'country':'US'},{'city':'NYC'}) I am developing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.