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
ValidationMessageFor() is a strongly typed extension method. It displays a validation message if an error exists for the specified field in the ModelStateDictionary object.
data-valmsg-for is the name of the input associated to the error message(s) being displayed. data-valmsg-replace specified whether error messages are to be replaced within this element.
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; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With