I have a property in a model. Lets say for an Email.
<Display(Name:="Email")>
<DataMember()>
Public Property Email As String
I want to use a different label for the email in every page so basically I’m asking if there is a way to use two display attributes for the same field? I would like to have something like this –
<Display(Name:="Email")>
<Display(Name:="Please Enter your Email")>
<DataMember()>
Public Property Email As String
and then choose in the page what label to use.
Is there a way, I can achieve this?
Attributes are read at compile time and become part of the assembly metadata. It seems like you want to decide at runtime what label to use.
For that, in your view, you could do something like..
So that’s the extra bit apart from the
[Display]attribute.