I am using property descriptor to generically iterate over the properties and print their attribute names as table header. It works fine printing the property name, but not for the [Display(Name = "Test")]
Class:
public class Transaction
{
[Display(Name = "Test")]
public string DELETE { get; set; }
public string PARTNO { get; set; } //Part Number
Markup:
@foreach (System.ComponentModel.PropertyDescriptor descriptor in System.ComponentModel.TypeDescriptor.GetProperties(Model[0]))
{
<th onclick="tableColumnSort(this)" class="tableSortHeaderBtnStyle">@descriptor.DisplayName;</th>
}
Just prints the "DELETE" name rather than "Test". The descriptor has a Name, and DisplayName option and both are set to "DELETE"
What am I doing wrong?