4
I bought a bootstrap template, the validation of the controls is done by a class that leaves the controls red. This would be the classes form-group has-error
Only that I never used this way, I’m used to using the code generated by himself: Example:
@Html.EditorFor(model => model.Campo, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Campo, "", new { @class = "text-danger" })
And then Validator writes the error message if the object comes back with error.
In the control I use the standard if (ModelState.IsValid)
How can I do to transform the class? If I can’t use the ValidationMessageFor
, how could I do?
UPDATING:
I want to change the textbox class and not display a message.
So, it’s almost that! Only instead of appearing a message I would like it to just circle the textbox with a red line. (no need to have css for this, just want to know how to change the <div class="form-group">
– Ricardo