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 9006803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:30:38+00:00 2026-06-16T01:30:38+00:00

If a user selects a value from an HTML drop down list A ,

  • 0

If a user selects a value from an HTML drop down list A, I want to make an ajax call to the server to populate the values in HTML drop down list B based on the user’s selection.

I am using ASP.NET MVC 4 with EF 4. How do I do that?

  • 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-06-16T01:30:39+00:00Added an answer on June 16, 2026 at 1:30 am

    Listen for the change event of first drop down and then load the content of second drop down in JSON format and inject that to the second drop down

    <select id="country">
      <option value='1'>USA</option>
      <option value='2'>Canada</option>
    </select>
    <select id="States"></select>
    

    and the script

    $(function(){
      $("#country").change(function(){
        var _this=$(this);
        var items="";
        $.getJSON("@Url.Action("GetStates","Country")/"+_this.val(),function(data){
               if(data.Status==="Success")
               {
                  $.each(data.Items,function(index, item){
                     items=+"<option value='"+item.ID+'">"+item.Name+"</option>";
                  });                 
               }
               $("#states").html(items);
        });
      });       
    });
    

    Assuming your GetStates action method returns JSON data with ID and Name as below.

    public ActionResult GetStates(int id)
    {
      List<State> stateList=yourRepositary.GetStatesForCountry(id);
      return Json(new { Status="Success", Items=stateList},
                                               JsonRequestBehaviour.AllowGet);
    }
    

    Assuming GetStatesForCountry method returns a list of State object with ID and Name as properties.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The user selects a state from a drop-down field, then ajax posts that value
drop down value not appearing for second list , tried everything .When user selects
I have two html drop down list, their value are retrieved from the database
I want to have a drop down menu where a user can select from
i want to display all table list from a database in drop down menu
I have the following select list from which the user can select multiple values.
I have a drop-down list box and two text fields of id values namely
i need to create html code, in which if user selects an item from
I have a User being reviewed drop down list, a SelectList of employees, and
I have got 2 drop down list in my php form. Values in the

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.