Link in validation summary message

asp.net-mvc-3, razor

Solution

Finally I chose another way to do it: create a div containing the link etc. outside of validation summary, and add the div only if modelstate is not valid:

@If Not ViewData.ModelState.IsValid Then
    @<div>read <a href="anotherpage.html">more</a></div>
End If

This is inspired by an answer to similar question.

Problem

Is it possible to put a HTML link in validation summary message? For example I want to put a link to another page in case there is validation error: ``` @Html.ValidationSummary(False, "read <a href=""anotherpage.html"">more</a>") ``` or ``` @Html.ValidationSummary(False, "read " & Html.ActionLink("more", "helpforerror").ToHtmlString) ``` But in the browser the tag is escaped so it doesn't form a link.

Original source

Related problems