2

I has required field like this

[Required(ErrorMessageResourceName = "AddCategoryCodeRequiredError", ErrorMessageResourceType = typeof(Resources.Category.Category))]
public string CategoryCode { get; set; }

and the error message in the resource file like this

<b>Required Field Missing</b> A code is required.

when the error displayed in the page the message part

<b>Required Field Missing</b> 

displayed as is not as bold text.

how can I display the message as html??

1 Answer 1

4

The Html.ValidationSummary helper is designed to HTML encode the error message. This basically means that you cannot use HTML tags inside your error messages. If you wanted to do so you will have to write a custom helper to display it which doesn't perform encoding. Here's an example with a custom validation summary helper. The same is true for the ValidationMessageFor helpers.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.