I am currently developing a registration page. When user already exists I want to provide login and reset password links for user in error message for email field. In contro
@Html.Raw(HttpUtility.HtmlDecode(Html.ValidationMessageFor(m => m.Email).ToHtmlString()))
Isn't pretty though
Read this post for evaluate errors
How to add validation errors in the validation collection asp.net mvc?
In your view
Html.ValidationMessage("Email")
Found this post while figuring this out myself using ASP.NET Core.
What I ended up doing was adding my part of my validation message in modelstate.AddError(), and separately adding to ViewData the bit that had the Html I wanted to render, like so:
ViewData["myKey"]= "My html";
It feels pretty ugly and there's probably better ways of doing it, but for my very limited needs, this fit the bill nicely.