在MVC 4中,为了在视图中启用客户端验证,在web.config中是否应该将ClientValidationEnabled和Unobtrusive
JavaScriptEnabled键都设置为true?
WEB.CONFIG
<add key="ClientValidationEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" />
解决方法
也可以通过控制器:
//Enable or Disable Client Side Validation at Application Level HtmlHelper.ClientValidationEnabled = true; HtmlHelper.UnobtrusiveJavaScriptEnabled = true;