简体   繁体   English

如何让ToolkitScriptManager获得更新版本的AJAX脚本?

[英]How do I make ToolkitScriptManager get a newer version of AJAX scripts?

I'm trying to upgrade the version of AjaxControlToolkit that we're using in a ASP.NET 3.5 project. 我正在尝试升级我们在ASP.NET 3.5项目中使用的AjaxControlToolkit版本。 It builds fine but when I load a page with an AjaxControlToolkit control on it gives the error: 它构建正常,但当我加载一个带有AjaxControlToolkit控件的页面时,它会给出错误:

JavaScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. JavaScript运行时错误:AjaxControlToolkit需要ASP.NET Ajax 4.0脚本。 Ensure the correct version of the scripts are referenced. 确保引用了正确版本的脚本。 If you are using an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll. 如果您使用的是ASP.NET ScriptManager,请切换到AjaxControlToolkit.dll中的ToolkitScriptManager。

We are using a class that extends ToolkitScriptManager with a reference to AjaxControlToolkit as our ScriptManager. 我们使用一个扩展ToolkitScriptManager的类,并引用AjaxControlToolkit作为我们的ScriptManager。

Having looked at the javascript, I can tell that the version that's being included does not contain some of the updates that the .js source files included in the toolkit download have. 看了javascript后,我可以看出所包含的版本不包含工具包下载中包含的.js源文件的一些更新。 I'm not sure where the ToolkitScriptManager is getting its AJAX .js files from but I need to find a way to force it to use the newer versions. 我不确定ToolkitScriptManager从哪里获取其AJAX .js文件,但我需要找到一种方法来强制它使用更新的版本。

Simply including them as embedded resources in the project has not worked. 简单地将它们作为项目中的嵌入资源包含在内并没有奏效。

I am building this project in VS2008 3.5 SP1 (as required by client). 我正在VS2008 3.5 SP1中构建此项目(根据客户端的要求)。 I am trying to build AjaxControlToolkit from the source code, as there are a few extensions which we need to apply to the Toolkit controls. 我正在尝试从源代码构建AjaxControlToolkit,因为我们需要将一些扩展应用于Toolkit控件。

I would be happy to provide further details if they're helpful. 如果它们有用,我很乐意提供进一步的细节。

EDIT: As it turns out, I had commented out the line ApplyAssembly(e.Script, false); 编辑:事实证明,我已经注释了ApplyAssembly(e.Script, false);ApplyAssembly(e.Script, false); in my copy of ToolkitScriptManager. 在我的ToolkitScriptManager副本中。 Putting it back in caused the execution to instead fail in GetBaseUrl with an InvalidOperationException : 将其重新放入导致执行在GetBaseUrl失败, GetBaseUrl带有InvalidOperationException

Assembly 'AjaxControlToolkit, Version=1.0.0.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' does not contain a Web resource with name 'MicrosoftAjax.js'. 程序集'AjaxControlToolkit,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 28f01b0e84b6d53e'不包含名为'MicrosoftAjax.js'的Web资源。

Ran into this problem on a new project I started yesterday. 在我昨天开始的一个新项目中遇到这个问题。 In the solution explorer, right click on your project. 在解决方案资源管理器中,右键单击您的项目。 Navigate to Manage NuGet Packages.. in the search box, type AjaxControlToolkit. 导航到管理NuGet包..在搜索框中,键入AjaxControlToolkit。 Install it and this should fix your problems! 安装它,这应该解决你的问题! If you need NuGet then go to http://www.nuget.org/ and install the package. 如果您需要NuGet,请访问http://www.nuget.org/并安装该软件包。 I hope this helps! 我希望这有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM