tags:

views:

91

answers:

2

I have a form for registration where the user has to select his university. After this, the user has to select the faculty.

When a value is selected in the university dropdownlist, I want to use AJAX to update the faculty based on the select university.

How would I go about accomplishing this?

A: 

Handle the SelectedIndexChange event on your University drop down. In that event handler, retrieve your list of faculty for the selected university. Iterate through your results and add list items to your Faculty drop down.

protected void UniversityDD_SelectedIndexChanged(object sender, EventArgs e)
{
    FacultyList = GetFaculty(UniversityDD.SelectedValue);

    foreach(Faculty faculty in FacultyList)
        FacultyDD.Items.Add(new ListItem(facultyDisplay, facultyValue));

}
Tyler
+2  A: 

Look into the CascasdingDropDown control in the AJAX.NET toolkit as well. It's very easy to use.

Tim