Let\'s say I have the following simple enum:
enum Response
{
Yes = 1,
No = 2,
Maybe = 3
}
How can I bind this enum to a DropDow
ASP.NET has since been updated with some more functionality, and you can now use built-in enum to dropdown.
If you want to bind on the Enum itself, use this:
@Html.DropDownList("response", EnumHelper.GetSelectList(typeof(Response)))
If you're binding on an instance of Response, use this:
// Assuming Model.Response is an instance of Response
@Html.EnumDropDownListFor(m => m.Response)