Cascading dropdowns

You can add drop-down menus to almost any Bootstrap component using the dropdown plugin. A cascading drop-down menu is a drop-down menu that updates its data based on a value selected in another drop-down menu. To add cascading drop-down menus, perform the following steps:

  1. Inside Visual Studio, add a new controller called DropdownController.cs to your Controllers folder.
  2. In the Index action, add the following code, which will create a list of managers and load a list of reporting employees for the selected manager:
            public IActionResult Index(int id = 2)        {        var managers = new List<EmployeeModel>();        var vicePresident = new EmployeeModel { Id = 2, Name = "Andrew         Fuller", JobTitle = "Vice President, ...

Get Bootstrap for ASP.NET MVC - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.