Hie, I want to add a CSS class to a particular SelectListIem in DropDowList in MVC Razor syntax.
I actually want to implement a CSS for:
new SelectListItem{ Text="Out Of 5", Value = "Out Of 5"},
instead of implementing for the entire control.
Below is the code snippet:
@Html.DropDownList("Options", new List<SelectListItem>
{
new SelectListItem{ Text="Select Options", Value = "1" },
new SelectListItem{ Text="CheckBox", Value = "1" },
new SelectListItem{ Text="Radio", Value = "2" },
new SelectListItem{ Text="Rating", Value = "3"},
new SelectListItem{ Text="Out Of 5", Value = "Out Of 5"},
new SelectListItem{ Text="Out Of 10", Value = "Out Of 10"},
new SelectListItem{ Text="Text", Value = "4"},
}, new { @class = "form-control input-group, dropdown-submenu" })
