这是我在母版页中的脚本部分:
<script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.ui.datepicker.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.ui.core.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.ui.widget.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.min.js" type="text/javascript"></script>
<script src="../../Scripts/Validation/MicrosoftMvcAjax.js" type="text/javascript"></script>
<script src="../../Scripts/Validation/MicrosoftMvcValidation.js" type="text/javascript"></script>
这就是我的表单的样子:
<% Html.EnableClientValidation(); %>
<% using (Html.BeginForm("Inscription", "Home", FormMethod.Post, new { @class = "search_form", enctype = "multipart/form-data"}))
{ %>
<%: Html.ValidationSummary(true) %>
<div class="editor-label">
<p>
<%: Html.LabelFor(model => model.Mailag) %>
</p>
</div>
<div class="editor-field">
<p>
<%: Html.EditorFor(model => model.Mailag, new { @class = "text longfield" })%>
<%: Html.ValidationMessageFor(model => model.Mailag) %>
</p>
// the reste of code is similaire to the first editor label :
</div>
<% } %>
我已经按照博客中的相同说明来激活客户端,但不幸的是它对我没有用:(我想我在这里遗漏了一些东西?服务器验证工作得很好。