Building asp.net mvc Html helper for Display.Description Data Annotation

I wanted to use the Data Attributes in asp.net MVC, for both a label, and a description. After finding out there isn’t a build in helper for Description, I searched and found an answer on StackOverflow.¬†Using that starter knowledge, I (copy/paste/enhanced) this little helper …


@Html.DisplayFor(m => m.PropertyName, cssClassName: "desc", "tagName: "div")

The sample code can be found in this github gist: https://gist.github.com/4469809

Hat Tip: Jakob Gade

Comments

comments