Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net中的RequiredFieldValidator问题_Asp.net_Visual Studio - Fatal编程技术网

Asp.net中的RequiredFieldValidator问题

Asp.net中的RequiredFieldValidator问题,asp.net,visual-studio,Asp.net,Visual Studio,我正在将RequiredFieldValidator添加到我的表单中,刚刚在web上测试了它,收到了这个错误 错误 我在web.config文件中添加了解决方案: <appsettings> <add value="None" key="ValidationSettings:UnobtrusiveValidationMode"></add> </appsettings> 最后一个错误是我在上面输入的解决方案有问题。。有没有其他人遇到过

我正在将RequiredFieldValidator添加到我的表单中,刚刚在web上测试了它,收到了这个错误

错误

我在web.config文件中添加了解决方案:

<appsettings>     <add value="None" key="ValidationSettings:UnobtrusiveValidationMode"></add>   </appsettings>
最后一个错误是我在上面输入的解决方案有问题。。有没有其他人遇到过这种情况并找到了解决方案?

希望您已将targetFramework设置为4.5。完整配置应该如下所示

<configuration>
  <appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None"></add>
  </appSettings>
    <system.web>
      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
    </system.web> 
</configuration>
如果此键值设置为None[默认值],ASP.NET应用程序将在页面中使用4.5之前的JavaScript内联行为,用于客户端验证逻辑。如果将此键值设置为WebForms,ASP.NET将使用HTML5数据属性和来自添加的脚本引用的后期绑定JavaScript来进行客户端验证逻辑

提醒:

-这说明它是v4.5的一项功能,您必须在cofig中指定targetFramework=4.5才能使其正常工作

HTTP Error 500.19 - Internal Server Error
<configuration>
  <appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None"></add>
  </appSettings>
    <system.web>
      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
    </system.web> 
</configuration>