Skip to content
Loading
Cascading Dropdownlist & ViewModel   

And in the end of the view, this is my JS section:

  1. "~/js/jquery-3.2.1.min.js">  
  2.   
 

This section calls this action:

  1.     public JsonResult GetDistrictList(int DepartmentID)  
  2. {  
  3.     List DistrictList = _context.Districts.Where(x => x.DepartmentID == DepartmentID).ToList();  
  4.     return Json(DistrictList);  
  5. }  

And that's it.

When I run the application, well, the District dropdownlist don't populate

_Questions:

Thanks in advance for any help.

Regards,

_Update:

I put a break point on this line, inside the JsonResult:

  1. List DistrictList = _context.Districts.
  2.       Where(x => x.DepartmentID == DepartmentID).ToList();  

But the application did not stopped there when I used the Department dropdownlist that is supossed to call that JsonResult. I believe the script section is what might be wrong.

 

2 Replies

Know the answer? Post it — somebody with the same question will find it here.