How would I configure my ViewModel and View to support a dropdown list that contained the following Enum:
public enum PersonType
{
Bride,
Groom
}
I would want the text of the dropdown to show “Bride”, “Groom” and the value to be 0 and 1 respectively. I would want to configure a default (either Bride or Groom) for the View as well. The purpose of this is for a “Create” form that I would post and later determine which option was selected (I’m guessing I would need an int within my ViewModel to track what the user selected). How would this get wired up? I’m using Razor.
in your model you will have a property like
in your controller
and in your view