O'Reilly logo

Bootstrap for ASP.NET MVC - Second Edition by Pieter van der Westhuizen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required