13

Can ASP.NET MVC's validation errors be styled? Where? I tried editing .input-validation-error class in Site.css but that didn't have any effect.

pom

1
  • Must have had issue when refreshing the page yesterday. Today .input-validation-error class does change the color of the input box with an error. However, changing border thickness doesn't have any effect. Commented May 18, 2011 at 9:33

2 Answers 2

37

If you style up .field-validation-error then this will change the validation error text messages.

.field-validation-error{ color: red; font-weight: bold; }

If you style up .input-validation-error then this will change the input style when there is a validation error.

.input-validation-error{ background: pink; border: 1px solid red; }
Sign up to request clarification or add additional context in comments.

Comments

1

It sounds like what you are doing is correct, but the css gets cached which means you won't necessarilly see the changes you make.

Once you have edited the css file, press Ctrl + F5 from your browser to reload css.

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.