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:
- Inside Visual Studio, add a new controller called
DropdownController.cs
to yourControllers
folder. - 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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.