Display value of EnumMember on Razor Page View

Hi, how do I display the value defined in my enum using EnumMember and have the value displayed on my razor page? For example, I want to display "Block A", "Block B", etc.. instead of BlockA, BlockB
using System.Runtime.Serialization;

namespace RoundingPortal.EntityModels.Enums
{
public enum Block
{
[EnumMember(Value = "Block A")]
BlockA,

[EnumMember(Value = "Block B")]
BlockB,

[EnumMember(Value = "Block D")]
BlockD,

[EnumMember(Value = "Block E")]
BlockE
}
}
using System.Runtime.Serialization;

namespace RoundingPortal.EntityModels.Enums
{
public enum Block
{
[EnumMember(Value = "Block A")]
BlockA,

[EnumMember(Value = "Block B")]
BlockB,

[EnumMember(Value = "Block D")]
BlockD,

[EnumMember(Value = "Block E")]
BlockE
}
}
<select asp-for="Block" asp-items="Html.GetEnumSelectList<Block>()" class="form-control"></select>
<select asp-for="Block" asp-items="Html.GetEnumSelectList<Block>()" class="form-control"></select>
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server