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\"
As the signature from the error message implies, the second argument must be an IEnumerable, more specifically, an IEnumerable of SelectListItem. It is the list of choices. You can use the SelectList type, which is a IEnumerable of SelectListItem. For a list with no choices:
@Html.DropDownList("PriorityID", new List(), new {@class="textbox"} )
For a list with a few choices:
@Html.DropDownList(
"PriorityID",
new List
{
new SelectListItem { Text = "High", Value = 1 },
new SelectListItem { Text = "Low", Value = 0 },
},
new {@class="textbox"})
Maybe this tutorial can be of help: How to create a DropDownList with ASP.NET MVC