If my model have
[DisplayName("First Name")]
public string firstName { get; set; }
Then I can print it in the View with LabelFor
@Html.LabelFor(model => model.acc_first)
It will then render as
<label for="firstName">First Name</label>
- But how can I "raw" read the property (FirstName) attributes in the View? If for example, I want to send the value to a function on the View page
Building on Darren Oster's answer:
Here's a link to the documentation for this: https://msdn.microsoft.com/en-us/library/system.web.mvc.html.displaynameextensions.displaynamefor(v=vs.118).aspx
You could use this in your view code like this: