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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Listen for the change event of first drop down and then load the content of second drop down in
JSONformat and inject that to the second drop downand the script
Assuming your
GetStatesaction method returnsJSONdata with ID and Name as below.Assuming
GetStatesForCountrymethod returns a list of State object withIDandNameas properties.