Is it possible (and how) to customize the HTML output of the HtmlHelper.ValidationMessage extension method in Asp.net MVC?
Is it possible (and how) to customize the HTML output of the HtmlHelper.ValidationMessage extension
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Other than passing in some html attributes, you will have to roll your own extension method if you need full customization (for example, to have it render as a
<div>instead of<span>)I would copy the ValidationMessage method from the mvc source code and customize it as needed.