I was using asp-items=\"@Html.GetEnumSelectList(typeof(Salary))\" in my Razor view with a select tag, to populate the list values based on the enum Salary
asp-items=\"@Html.GetEnumSelectList(typeof(Salary))\"
enum Salary
I managed to solve it. I just had to use the other method of GetEnumSelectList<>, and in the Razor view we need to use the Display attribute.
GetEnumSelectList<>
Here is the code:
Razor View:
Enum Salary:
public enum Salary { [Display(Name="Paid Monthly")] PaidMonthly = 1, PaidYearly = 2 }