ASP.NET MVC - Add XHTML into validation error messages

Posted by Neil on Stack Overflow See other posts from Stack Overflow or by Neil
Published on 2010-03-21T12:43:12Z Indexed on 2010/03/21 13:01 UTC
Read the original article Hit count: 283

Hi,

Just starting with ASP.Net MVC and have hit a bit of a snag regarding validation messages. I've a custom validation attribute assigned to my class validate several properties on my model.

When this validation fails, we'd like the error message to contain XHTML mark-up, including a link to help page, (this was done in the original WebForms project as a ASP:Panel).

At the moment the XHTML tags such as "< a >", in the ErrorMessage are being rendered to the screen. Is there any way to get the ValidationSummary to render the XHTML markup correctly? Or is there a better way to handle this kind of validation?

Thanks

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc