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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:34:41+00:00 2026-05-11T03:34:41+00:00

Anyone known how to polulate a combo with values that depends on the user

  • 0

Anyone known how to polulate a combo with values that depends on the user seleccion, I have to combo, Country and Region, When the user select contry I need to go to the database and get the region of the country, Anyone knwows how to do this, if posibile using AJAX.

Thanks.

  • 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. 2026-05-11T03:34:42+00:00Added an answer on May 11, 2026 at 3:34 am

    Do you need to use a particular Ajax libarary?

    The Ajax.Net Control Toolkit has the Cascading Dropdown control pre-built for this functionality.


    Missed the MVC part, in which case the Ajax Control Toolkit won’t work. jQuery is probably the best option, since it makes Ajax extremely easy to code and MS is officially supporting it in conjunction with the MVC framework.

    If you created a RESTful service on your site (there should be plenty of documentation on how to do this) you can return a json response through jQuery like this:

    The markup:

    <select id='opt1'>   <option value='1'>Option 1</option>   <option value='2'>Option 2</option> </select>  <select id='opt2' disabled></select> 

    Assuming the service will accept ‘id’ as a parameter and return a json object using this schema for example:

    [   { name: 'option1', value: '1'},   { name: 'option2', value: '2'} ] 

    You’d add this javascript to the page:

    $(function() {   $('select#opt1').change(function(){     $.getJSON('/data/myservice',{id: this.value},       function(response) {         var options = '';         for (var i = 0; i < response.length; i++) {           options += '<option value='' + response[i].value + ''>'                   +  response[i].name + '</option>';         }         $('select#opt2').removeAttr('disabled').html(options);       });   }); }); 

    A quick explanation of what’s going on there; jQuery code can be a bit like peeling an onion, so I’ll take it a level at a time:

    $(function(){}) is shorthand for $(document).ready(function(){}), so it runs the function when the ready event fires.

    $('select#opt1').change(function(){}) finds the <select> named ‘opt1’ and runs the function when the change event fires.

    $.getJSON() does the Ajax call for you. JSON responses are returned as strings, and have to be parsed into JSON objects, which $.getJSON does for you automatically. The first field is the url of the service, the second is a name/value pair that is converted to a querystring, and the third is the callback function to handle the response.

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

Sidebar

Related Questions

Anyone knows if there is an easy or known way to write a deep
Anyone know this compiler feature? It seems GCC support that. How does it work?
I'm working on a project that uses MSTest for unit testing and I need
i have a dropdownlist that populates from the sql server database. populating the list
Does anyone know of a link to a reference on the web that contains
I have a Model with data that I want to use to populate a
I have one procedure which updates record values, and i want to fire it
I have a mysql database that I'm trying to populate from a text file.
Anyone know if it's possible to databind the ScaleX and ScaleY of a render
Anyone know of a way to capture keyboard events (keyup / keydown) in Portable

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.