Reputation: 1201
Im beginner for the MVC, I want to style my MVC validation how can i do it?
<div class="col-md-6">
@Html.ListBoxFor(a => a.QRefIds, new MultiSelectList(ViewBag.QltyRfs, "QReferenceId", "QReferenceCode"), new { Class = "form-control", title = "Select Feeder List", style = "width:575px;height:50px; margin-top:6px;font-size:small;" })
@Html.ValidationMessageFor(a => a.QRefIds)
</div>
Upvotes: 0
Views: 1845
Reputation: 10824
The validation helpers generate bunch of span
with a class field-validation-error
you can change that using CSS:
.field-validation-error {
background-color:white;
border-radius:4px;
border: solid 1px #333;
display: block;
position: absolute;
top:0; right:0; left:0;
text-align:right;
}
You can also style up input-validation-error
when there is a validation error for inputs:
.input-validation-error{ background: pink; border: 1px solid red; }
Upvotes: 3