As well as DisplayName eg.
[DisplayName("Address line 1 ")]
public string Address1{get; set;}
Html.LabelFor(model => model.Address1)
I have a requirement to show tooltips eg.
[DisplayName("Address line 1 ")]
[ToolTip("The first line of your address as it appears on you bank statement")]
public string Address1{get; set;}
Html.LabelFor(model => model.Address1)
Html.ToolTipFor(model => model.Address1)
Can I extend the DisplayName DataAnnotation to do this? I can’t see how it can be done.
Thanks!
This is how I would do it. Time for some Champions League, I can clarify the code tomorrow if you want.
First a attribute:
And then a html helper to allow us to write Html.TooltipFor():
Usage would then be this:
Your model:
And in your view: