I am trying to use EnumDropDownListFor in the following fashion:
@Html.EnumDropDownListFor(model => model.Title, "Select a Title", new { @class = "form-control" })
But it is not setting the selected value. I have even tried setting the title in the line before but it has not worked. I am using this code in the same view for a different enum and it works fine and the code above works fine on other pages as well. The declaration of the property is like this:
[DataMember]
public Title Title { get; set; }
and the enum looks like this:
public enum Title
{
Ms = 1,
Miss,
Mrs,
Mr,
Master,
Rev,
Fr,
Dr,
Prof,
Lady,
Lord,
Sir
}
The rest of the view was auto generated by vs2017. Any idea what I am doing wrong?