Here Mudassar Ahmed Khan has explained with an example, how to implement Grouped DropDownList using HTML OptGroup element in ASP.Net MVC Razor.
The Grouped DropDownList will be populated from database using Entity Framework in ASP.Net MVC Razor.
In HTML DropDownList OptGroup element, which is used to Group items (options) of a DropDownList while in MVC, the Grouping of DropDownList items (options) is done using SelectListItem class and SelectListGroup class.
↧