在MVC4更改默认的ValidationSummary模板 [英] Change default ValidationSummary template in MVC4

查看:366
本文介绍了在MVC4更改默认的ValidationSummary模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想改变默认的 Html.ValidationSummary()模板,以使其与Twitter的引导工作。我在哪里可以找到它?

I want to change default Html.ValidationSummary() template in order to make it work with twitter bootstrap. Where can I find it?

只会导致我发现了<一个href=\"http://stackoverflow.com/questions/524935/how-to-change-the-template-for-the-validationsummary\">this.但它并不能帮助。我需要的,因为我使用的客户端验证更改源本身。我检查 jquery.validate.js jquery.validate.unobtrusive.js ,但没有HTML code那里。

Only lead I found was this. But it does not help. I need to change the source itself since I'm using client-side validation. I've checked jquery.validate.js and jquery.validate.unobtrusive.js but no html code there.

推荐答案

让你无论是需要改变它在CSS。

so you either need to change it in CSS.

检查该<一个href=\"http://www.w3resource.com/twitter-bootstrap/example-alerts-on-error-success-and-information-with-twitter-bootstrap.html\"相对=nofollow> 链接

变线这种方式在添加.alert错误和自动生成的类 .validation-汇总错误,还添加了相关的类。

change line this way add in .alert-error and auto generated class .validation-summary-errors , also add related class.

.alert-error, .validation-summary-errors {
  color: #b94a48;
  background-color: #f2dede;
  border-color: #eed3d7;
}

所以这样的方式来改变CSS类。

自动生成的CSS类的ValidationSummary

.validation-summary-errors {
    background-color: #D9FFB2;
    border:1px solid #5CBA30;
    width: 400px;
    }
span.validation-summary-errors {
    border-bottom-color: #D9FFB2;
    display:block;
    }
ul.validation-summary-errors {
    margin:0;
    padding:0;
    border-top:none;
    }

这篇关于在MVC4更改默认的ValidationSummary模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆