I am working on a VB.NET project which is using ASP.NET MVC 2. I am taking advantage of the ability to add validation and other attributes to the metadata in my model.
For example, I have added attributes such as <DisplayName("Full Name")>
to the properties in my model and am rendering these using the Html.LabelFor ()
extension method.
I have also added <Description ("This is a description of the field.")>
attributes to various properties in the model and would like to render these in a similar way.
My question is - does an extension method exist which will do this for me?
If there isn't, could someone steer me in the right direction for writing my own? I've started one based on the method signature of the existing methods...
<ExtensionAttribute()> _
Public Function HintFor(Of TModel, TProperty) _
(ByVal htmlHelper As HtmlHelper(Of TModel), _
ByVal expression As Expression(Of Func(Of TModel, TProperty))) As MvcHtmlString
End Function
But I must admit the 'expression' part of this goes well beyond my Lambda / LINQ / ?? knowledge at this stage!!
Thanks in advance...