I think this is a very simple question but I can't find any solution or I think I don't know how to search with such something, so if this question has been asked before please point me to such a duplicate
Suppose I have a class like this:
public class Company
{
public int ID { get; set; }
public Nullable<int> ApplicationID { get; set; }
[Required(AllowEmptyStrings = false, ErrorMessageResourceType = typeof(MyResource),
ErrorMessageResourceName = "RequiredCompanyName")]
[Display(Name = "CompanyName", ResourceType = typeof(MyResource))]
public string EntityName { get; set; }
public Nullable<int> EntityID { get; set; }
}
I want to get the name of the attribute associated with Property EntityName
in a razor view. I know it's pretty easy to get the resource string value using DisplayFor
html helper, but I need here to get the name of the attribute value associated with the property which in this case is the string "CompanyName".
Is this doable ?