6
在ASP.NET MVC 2 RC2中启用客户端验证后,验证摘要消息即使在我第一次加载时也是可见的Edit.aspx页面。它不会以粗体显示,但只是纯文本。如果我提交表单时出现错误,那么验证摘要消息将变成红色,并在下面显示错误列表。错误? ASP.NET MVC 2中的客户端验证会导致即使没有错误也会显示ValidationSummary消息
这里是包含验证摘要代码:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MyApp.ViewModels.PersonEditorViewModel>" %>
<script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>
<% Html.EnableClientValidation(); %>
<% using (Html.BeginForm())
{
%>
<%= Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") %>
<%= Html.EditorForModel() %>
<p>
<input type="submit" value="Save" />
</p>
<%
}
%>
这是一个错误还是我做错了什么?如果它是一个错误,是否有解决方法?
注意:如果我关闭客户端验证,一切正常。
你明白了,列维。谢谢。 – devuxer 2010-02-18 02:57:04
更具体地说,它可能是缺少以下条目:'.validation-summary-valid {display:none; }' – 2010-05-29 20:45:51