Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

DisplayFor doesn't retrieve enum values #2430

Closed
@weitzhandler

Description

@weitzhandler

The enum support is indeed a great add, thanks for implementing it.

Anyway, I've found something missing about it, when calling DisplayFor(model => model.EnumField) doesn't render the enum value, it won't retrieve the value from resources, but it will render the original value:

public enum MaritalStatus : byte
{
  [Display(ResourceType = typeof(PersonResx), Name = "MaritalStatus_None")]
  None,
  [Display(ResourceType = typeof(PersonResx), Name = "MaritalStatus_Single")]
  Single,
  [Display(ResourceType = typeof(PersonResx), Name = "MaritalStatus_Married")]
  Married,
  [Display(ResourceType = typeof(PersonResx), Name = "MaritalStatus_Divorced")]
  Divorced,
  [Display(ResourceType = typeof(PersonResx), Name = "MaritalStatus_Widowed")]
  Widowed
}

The above works just fine with @Html.EnumDropDownListFor(model => model.MaritalStatus), but doesn't work for DisplayFor.

Please fix this.

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions