For this, we first need to create 2 model classes, one for Department and another for Designation as below:

  1. public class Department
  2. {
  3. public int DeptCode { get; set; }
  4. public string DeptName { get; set; }
  5. }
  6. public class Designation
  7. {
  8. public int DesigCode { get; set; }
  9. public string DesigDesc { get; set; }
  10. public int DeptCode { get; set; }
  11. }
We must then provide the controller code for these. Here first the department dropdown is populated. And after selecting a specific department, the related designation will be populated in the designation dropdown.
  1. public JsonResult GetDeptList()
  2. {
  3. List<Department> lstDept = DeptList();
  4. return Json(lstDept, JsonRequestBehavior.AllowGet);
  5. }
  6. public List<Department> DeptList()
  7. {
  8. List<Department> lstDept = new List<Department>();
  9. lstDept.Add(new Department { DeptCode = 1, DeptName = "Account" });
  10. lstDept.Add(new Department { DeptCode = 2, DeptName = "Sales" });
  11. lstDept.Add(new Department { DeptCode = 3, DeptName = "Marketing" });
  12. lstDept.Add(new Department { DeptCode = 4, DeptName = "Admin" });
  13. lstDept.Add(new Department { DeptCode = 5, DeptName = "HR" });
  14. return lstDept;
  15. }
  16. public JsonResult GetDesigList(int? DeptCode)
  17. {
  18. List<Designation> lstDesig = DesigList().Where(s => s.DeptCode == DeptCode).ToList();
  19. return Json(lstDesig, JsonRequestBehavior.AllowGet);
  20. }
  21. public List<Designation> DesigList()
  22. {
  23. List<Designation> lstDesig = new List<Designation>();
  24. lstDesig.Add(new Designation { DesigCode = 1, DesigDesc = "Accountant", DeptCode = 1 });
  25. lstDesig.Add(new Designation { DesigCode = 2, DesigDesc = "Sr. Accountant", DeptCode = 1 });
  26. lstDesig.Add(new Designation { DesigCode = 3, DesigDesc = "Sales Man", DeptCode = 2 });
  27. lstDesig.Add(new Designation { DesigCode = 4, DesigDesc = "Manager", DeptCode = 3 });
  28. lstDesig.Add(new Designation { DesigCode = 5, DesigDesc = "HR Executive", DeptCode = 5 });
  29. return lstDesig;
  30. }
Here the GetDesig() methods takes the department code as input parameter and returns the desired designation list.

The following is the code for the view:
  1. @{
  2. ViewBag.Title = "DropDown List";
  3. Layout = "~/Views/Shared/_Layout.cshtml";
  4. }
  5. <h2>Index</h2>
  6. <div>
  7. <h2>Employee Work Details</h2>
  8. <p>
  9. <label for="Department">Department:</label>
  10. @(Html.Kendo().DropDownList()
  11. .Name("cmdDept")
  12. .HtmlAttributes(new { style = "width:300px" })
  13. .OptionLabel("Select Department...")
  14. .DataTextField("DeptName")
  15. .DataValueField("DeptCode")
  16. .DataSource(source =>
  17. {
  18. source.Read(read =>
  19. {
  20. read.Action("GetDeptList", "Custom");
  21. });
  22. })
  23. )
  24. </p>
  25. <p>
  26. <label for="Designation">Designation:</label>
  27. @(Html.Kendo().DropDownList()
  28. .Name("cmbDesig")
  29. .HtmlAttributes(new { style = "width:300px" })
  30. .OptionLabel("Select Designation...")
  31. .DataTextField("DesigDesc")
  32. .DataValueField("DesigCode")
  33. .DataSource(source =>
  34. {
  35. source.Read(read => { read.Action("GetDesigList", "Custom").Data("filterDesig"); }).ServerFiltering(true);
  36. })
  37. .Enable(false)
  38. .AutoBind(false)
  39. .CascadeFrom("cmdDept")
  40. )
  41. <script>
  42. function filterDesig() {
  43. return {
  44. deptcode: $("#cmdDept").val()
  45. };
  46. }
  47. </script>
  48. </p>
  49. <p>
  50. @(Html.Kendo().DropDownList()
  51. .Name("cmbFilter")
  52. .HtmlAttributes(new { style = "width:90px" })
  53. .OptionLabel("")
  54. .DataTextField("Text")
  55. .DataValueField("Value")
  56. .BindTo(new List<SelectListItem>()
  57. {
  58. new SelectListItem() { Text="All", Value="ALL", Selected=true },
  59. new SelectListItem() { Text="Approved", Value="A" },
  60. new SelectListItem() { Text="On Approval", Value="OA" }
  61. })
  62. )
  63. </p>
  64. </div>
For calling the view, the following is the code for the controller:
  1. public ActionResult DropDownList()
  2. {
  3. return View();
  4. }