My aim is to get the display name attribute from my enumerables so that I can display their values on an index page without having strange formatting and instead clear, readable lines.
My enumerables look like this:
public enum UserStatus
{
[Display(Name = "Display Name 1")]
_x = 0,
[Display(Name = "Display Name 2")]
_y = 1,
[Display(Name = "Display Name 3")]
_z = 2
}
And the HTML looks like:
@Html.DisplayFor(modelItem => item.UserStatus)
I've tried using this suggestion but I ended up getting some strange errors and couldn't manage to get it to work. If anyone knows how to get the attribute from the enum then I'd greatly appreciate the help.