WebForms UnobtrusiveValidationMode 需要“jquery”ScriptResourceMapping

错误信息:

 

WebForms UnobtrusiveValidationMode 需要“jquery”ScriptResourceMapping。请添加一个名为 jquery (区分大小写)的 ScriptResourceMapping。 说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。           

异常详细信息: System.InvalidOperationException: WebForms UnobtrusiveValidationMode 需要“jquery”ScriptResourceMapping。请添加一个名为 jquery (区分大小写)的 ScriptResourceMapping。

源错误:

执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。


堆栈跟踪:

[InvalidOperationException: WebForms UnobtrusiveValidationMode 需要“jquery”ScriptResourceMapping。请添加一个名为 jquery (区分大小写)的 ScriptResourceMapping。]
   System.Web.UI.ClientScriptManager.EnsureJqueryRegistered() +2365285
   System.Web.UI.WebControls.BaseValidator.RegisterUnobtrusiveScript() +11
   System.Web.UI.WebControls.BaseValidator.OnPreRender(EventArgs e) +9641449
   System.Web.UI.Control.PreRenderRecursiveInternal() +83
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974


 


版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.5.27.0           

 

解决方法如下

方法一:

修改Web.config文件如下:

<configuration>

  <appSettings>

    <add key="ValidationSettings:UnobtrusiveValidationMode"value="None" />

  </appSettings>

      

……

</configuration>

 

方法二:

修改全局应用程序类Global.asax

1.    添加程序集引用:using System.Web.UI;

2.    在类Global的Application_Start方法中添加如下代码:

ScriptManager.ScriptResourceMapping.AddDefinition("jquery",

     new ScriptResourceDefinition

     {

         Path = "~/scripts/jquery-1.7.2.min.js",

         DebugPath = "~/scripts/jquery-1.7.2.min.js",

         CdnPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.min.js",

         CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.js"

     }

);

3.    在解决方案项目目录下新建scripts文件夹,放入文件jquery-1.7.2.min.js

 

以下两种方法仅供参考,对理解错误产生的原因有帮助!

方法三:

aspx页面的Page_Load方法中添加如下代码:

UnobtrusiveValidationMode = UnobtrusiveValidationMode.None;

 

方法四:

把文件AspNet.ScriptManager.jQuery.dll添加到项目的引用中。该方法可以消除错误,但是会导致验证控件不起作用。

展开阅读全文

pb webforms 调用webservice

12-30

soap连接如果直接像PB webservice client 端从pbsoapclient125.pbd中直接调用soapconnection 在webforms 发布的时候编译会出错的。rn解决办法:建立一个custom 直接把下面代码copy到该custom 的edit source 下面。希望对你们有帮助。rnforwardrnglobal type soapconnection from nonvisualobjectrnend typernend forwardrnrnglobal type soapconnection from nonvisualobject native "pbwsclient125.pbx"rnpublic function string generateproxy(string wsdl, string servicename)rnpublic function long createinstance(ref powerobject obj, string proxyname, string portname)rnpublic function long createinstance(ref powerobject obj, string proxyname)rnpublic function long setoptions(string options)rnpublic function long setproxyserveroptions(string proxyoptions)rnpublic function long SetSoapLogFile(string Filename)rnpublic function long UseIntegratedWindowsAuthentication(boolean useIWA)rnpublic function long SetClientCertificateFile(string Filename)rnpublic function long SetTimeout(long Seconds)rnpublic function long SetBasicAuthentication(string Domain, string userID, string Password)rnpublic function long SetProxyServer(string hostname, long port, string userID, string Password)rnpublic function long SetProxyServer(string Address, string userID, string Password)rnpublic function long RemoveAuthentication()rnpublic function long UseConnectionCache (boolean cache)rnpublic function powerobject dynamiccast(powerobject proxyobject, readonly string proxyname)rnpublic function long SetBypassProxyOnLocal(boolean bypassProxyOnLocal)rnpublic function long AddToBypassList(string value)rnpublic function long RemoveBypassList()rnpublic function long SetUseDefaultProxySetting(boolean UseDefaultProxySetting)rnpublic function long SetKeepAlive(boolean KeepAlive)rnend typernglobal soapconnection soapconnectionrnrnon soapconnection.createrncall super::creaternTriggerEvent( this, "constructor" )rnend onrnrnon soapconnection.destroyrnTriggerEvent( this, "destructor" )rncall super::destroyrnend onrnrn 论坛

没有更多推荐了,返回首页