Search code examples
c#htmlasp.net-mvcrazorvalidationsummary

C# MVC Razor Html.ValidationSummary show message as HTML


I want to show the validation summary as HTML format, for example.

Code behind (controller):

ModelState.AddModelError("", "Account not confirmed<br />Click <a href='#'>here</a> to resend the email confirmation");

Razor View:

@Html.ValidationSummary(true, "", new { @class = "text-danger" });

An the rendered HTML is like:

Account not confirmed<br />Click <a href='#'>here</a> to resend the email confirmation

I mean, the html message is shown as it, but I want it to show with HTML tags.


Solution

  • Thanks everyone for your time ... I found what I need:

    Render HTML in a Validation Message in ASP.NET MVC