I bought a bootstrap template, the validation of the controls is done by a class that leaves the controls red. This would be the form-group has-error
classes
Except that I've never used it that way, I'm used to using the code it generated itself: Example:
@Html.EditorFor(model => model.Campo, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Campo, "", new { @class = "text-danger" })
And then the validator writes the error message if the object returns with an error.
In control I use the default if (ModelState.IsValid)
How can I do to transform the class? If you can not use ValidationMessageFor
, how could I do it?
UPDATE:
I want to change the textbox class and not display a message.