• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 7207
  • Last Modified:

Populating Dropdownlist using AJAX

I have two dropdown and if i select one dropdown the corresponding values will be fetch from Database and fill into another drop down.

In this case how to use AJAX in ASP Page
0
sti2006
Asked:
sti2006
3 Solutions
 
dfu23Commented:
Something like this article should be very helpful:

http://www.w3schools.com/ajax/ajax_database.asp

If you have questions past what this article covers let me know ...
0
 
Anubis2005Commented:
You can use the examples in this page to create the AJAX interaction.  Once the interaction has returned you can itterate through the XML or returned variables to populate the select list.

http://developer.mozilla.org/en/docs/AJAX:Getting_Started


To enter completly new populations in a select list, use the following function in a loop adding the items to the select list.  In order to initially empy the select list, set it's 'length' to 0.


function SelectAdd(SelectField, NewValue, NewText){

  // RESET THE SELECT SIZE
  var SelectLength = SelectField.length++;
 
  // ADD THE OPTION
  SelectField.options[SelectLength].value = "" + NewValue + "";
  SelectField.options[SelectLength].text = "" + NewText + "";
 
} // END FUNCTION
0
 
EsopoCommented:
A thorough review on how to populate dropdown lists using AJAX, with server-side source code in both ASP & PHP:
http://www.expertsrt.com/tutorials/Rod/ajaht.php
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now