我的控制器代码:
[HttpPost]
public ActionResult Login(LoginViewModel loginVM)
{
var isLogin = SessionContext.Instance.AuthMgr
.Login(loginVM.Email, loginVM.Password);
if (!isLogin)
{
ModelState.AddModelError(String.Empty, "wrong email/passord");
return View(loginVM);
}
User user = SessionContext.Instance.AuthMgr.User;
return RedirectByUser(user);
}
我的观看代码:
@Html.ValidationSummary(true, null, new { @class = "alert" })
问题是:当我的模型中出现属性错误时,不应显示VaidatonSummary
包装器。
<div class="validation-summary-errors alert"><ul><li style="display:none"></li>
</ul></div>
我的问题在这里描述:Why is ValidationSummary(true) displaying an empty summary for property errors?
答案 0 :(得分:0)
删除
@Html.ValidationSummary(true, null, new { @class = "alert" })
从视图