I am developing a web application and .NET Core and recently bumped against this issue.
It shows the Id of the enum value in: @Html.DisplayFor(model => model.MutatieReden)
but I want to show the name for the enum as this is a 'Details' view.
My enum is built like this, am I missing something?:
//Class property
public Reden? MutatieReden { get; set; }
//Enum
public enum Reden
{
[Display(Name = "Niet van toepassing")] NietVanToepassing = 1,
[Display(Name = "Administratieve reden")] AdministratieveReden = 2,
[Display(Name = "Niet akkoord klant")] NietAkkoordKlant = 3,
[Display(Name = "Incasso blokkade")] IncassoBlokkade = 4,
}
I tried various solutions but most of them were for regular ASP.NET MVC and answers were all outdated.
EDIT: This is not a duplicate as this is for ASP.NET Core and the other solutions are for .NET MVC 5.1. Tried these solutions already.