I want to add two default options to my dropdowns in asp.net MVC using the html helper class, they are “–Please Select–” and “–Other–“.
I can add one static option using
<%= Html.DropDownList("ddlserviceGroup",
(IEnumerable<SelectListItem>)ViewData["ServiceGroups"], "--Select Item--")%>
But i need to add two options and can’t seem to figure it using the HTML helper class
The existing helper doesn’t allow this. I’d suggest adding the options in the controller or perhaps writing your own extension method.
In View