我有一个简单的登录页面,突然开始真正达到作用的结果,而不是显示在EF数据中定义的客户端验证消息(升级的jquery.js和jQuery的ui.js分别为1.10.2和1.10.3后)注释。
于是我发现,除去我除了用户和密码的唯一CheckBoxFor,提交按钮的实际工作,因为它应该是这样,它提高了客户端验证只是没有达到控制器。
任何原因的行为呢?
谢谢 !!
下面的代码:
@using System.Web.Optimization;
@model MyProject.Models.LogOnModel
@{
ViewBag.Title = "Entrar";
}
<h1>@ViewBag.Title</h1>
<p>
Se pretende obter acesso clique @Html.ActionLink("aqui", "Register").
</p>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryval")
@using (Html.BeginForm())
{
@Html.ValidationSummary(true, "O seu acesso falhou. Por favor corriga os erros e tente novamente.")
<div>
<fieldset>
<legend>Informação da sua conta</legend>
<div class="editor-field">
@Html.LabelFor(m => m.Email)
@Html.TextBoxFor(m => m.Email, new { @class = "medium-editor" })
@Html.ValidationMessageFor(m => m.Email)
</div>
<div class="editor-field">
@Html.LabelFor(m => m.Password)
@Html.PasswordFor(m => m.Password, new { @class = "medium-editor" })
@Html.ValidationMessageFor(m => m.Password)
</div>
<input type="submit" value="Entrar" />
@Html.CheckBoxFor(m => m.RememberMe)
@Html.LabelFor(m => m.RememberMe)
</fieldset>
</div>
}
<p>
Esqueceu a sua password?
Clique @Html.ActionLink("aqui", "ForgotPassword", "Account") para recuperar a sua password.
</p>