In my MVC 3 Razor app, I have a Model with an enum..
Model Example:
public class EmployeeModel
{
public enum Title
{
Accountant = 111,
Sales =
I just stumbled on this StackO question/answer - not only is my question here an exact duplicate, but the answer given by Mike McLaughlin is the best solution I've seen for using DropdownListFor<> with Enums. Specifically, Mike points us to a solution that he found by Morgan Leroi
Morgan's quick solution is:
@Html.DropDownListFor(model => model.State, new SelectList(Enum.GetValues(typeof(MyNamespace.Enums.States))))
But, Morgan has made an Extension that makes the implementation of the DropDownListFor<> with enums even more compact. You can download Morgan's Visual Studio Solution here.
That said, I think we should close this question as it's an exact duplicate.