문제

I'm trying to upgrade the version of AjaxControlToolkit that we're using in a ASP.NET 3.5 project. It builds fine but when I load a page with an AjaxControlToolkit control on it gives the error:

JavaScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll.

We are using a class that extends ToolkitScriptManager with a reference to AjaxControlToolkit as our 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. 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.

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). 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.

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); in my copy of ToolkitScriptManager. Putting it back in caused the execution to instead fail in GetBaseUrl with an InvalidOperationException:

Assembly 'AjaxControlToolkit, Version=1.0.0.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' does not contain a Web resource with name 'MicrosoftAjax.js'.

도움이 되었습니까?

해결책

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. Install it and this should fix your problems! If you need NuGet then go to http://www.nuget.org/ and install the package. I hope this helps!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top