Anyone know if it is possible to do the following:
public class User
{
public Guid UserID { get; set; }
[Required(ErrorMessage="A school selection is required.")]
[Range(1, int.MaxValue, ErrorMessage="School not found. Please contact support at <a href='mailto:support@mysite.com'>support@mysite.com</a>")]
public int SchoolID { get; set; }
// ... other properties
}
And not have @Html.ValidationMessageFor(model => model.SchoolID) encode the HTML? Maybe I need to make a custom helper extension for this? Is there an easier way? Any guidance would be appreciated. If a helper extension is the way to go, how could I access the validation rules in the helper extension method to make sure the html doesn’t get encoded?
Thanks.
I did some more searching and came across the SO post below that addresses how to do what I am asking. I’ve added that answer here in case anyone comes across this in the future. I’m going to mark this as the answer as well since it is closest to the best answer I was looking for, but I’ll let the moderators decide if this needs to be closed as a duplicate.
Render HTML tags inside of HTML.ValidationMessageFor in MVC3