ValidationSummary控件无法弹出错误提示框

使用控件RequiredFieldValidator加上ValidationSummary,验证必填项是否为空,若为空则在消息框中显示错误,实际测试中发现并不弹出消息框。甚至页面会显示“ [color=yellow]WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).[/color] ”。

从网上找到修改Web.config文件的解决方案:
将httpRuntime targetFramework="4.5"中的4.5改成4.0

发现是ASP.NET 4.5对验证控件的影响(兼容性),使用ASP.NET 4.5的解决方法:
在web.config的中appSettings标签中添加如下的设置:
add key="ValidationSettings:UnobtrusiveValidationMode" value="None"

你可能感兴趣的:(validation)