I\'m building my first MVC application after years of doing webforms, and for some reason I am not able to make this work:
@Html.DropDownList(\"PriorityID\"
Simply Try this
@Html.DropDownList("PriorityID", (IEnumerable)ViewBag.PriorityID, new { @class="dropdown" })
But if you want a default value or no option value then you must have to try this one, because String.Empty
will select that no value for you which will work as a -select-
as default option
@Html.DropDownList("PriorityID", (IEnumerable)ViewBag.PriorityID, String.Empty, new { @class="dropdown" })