fill data in dropdown box as per previous dropdown box data selected in aspnet mvc 1
- by FosterZ
hi, i'm buildin' an employee registration form in aspnet mvc, i have fields like "School" list in 1 dropdown box and "Department" list another, problem is i want to show Department list on change of School list, i have done followin' code:
public ActionResult EmployeeCreate()
{
var getSchool = SchoolRepository.GetAllSchoolsInArray();//this gets school_id as value and school_name as text for dropdown box
ViewData["SchoolsList"] = getSchool;
return View();
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult EmployeeCreate()
{
_employeeRepository.CreateEmployee(employeeToCreate);
_employeeRepository.SaveToDb();
}
Here is the View
Html.DropDownList("SchoolLists")
Html.DropDownList("DepartmentLists")
now, how do i get the departments of selected school in dropdown boxes