Categories
Web Development

Allow HTML in MVC’s Html.ValidationMessageFor or Html.ValidationSummary

Have you ever wanted to put HTML in the validation message for a property or in the validation summary? You can’t do this out of the box, since any message that gets run through either of these methods gets put into the element’s InnerText. But thankfully, we can create simple extensions to allow HTML in both of these validation methods.