Bootstrap 3 + MVC 5 - validation css tips

1. the default MVC 5 site.css is missing some style for validation style on form-control. problem resolved after adding the missing css to site.css


/* styles for validation helpers */
.field-validation-error {
    color: #b94a48;
}

.field-validation-valid {
    display: none;
}

input.input-validation-error {
    border: 1px solid #b94a48;
}


select.input-validation-error {
border: 1px solid #b94a48;
}

input
[type="checkbox"].input-validation-error {
    border: 0 none;
}

.validation-summary-errors {
    color: #b94a48;
}

.validation-summary-valid {
    display: none;
}

Reference - http://weblogs.asp.net/jdanforth/form-validation-formatting-in-asp-net-mvc-5-and-bootstrap-3


2. Use Html.ValidationSummary() to show custom mode state error: ModelState.AddModelError(string.Empty, "There is something wrong with Foo.");

展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读