最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

asp.net - 'AjaxControlToolkit' is undefined Error - Stack Overflow

programmeradmin1浏览0评论

I am using the AjaxControlToolkit in VS2005, and it works fine. I do have some issues though, when I go to some pages I have, then click back, I get this JavaScript error:

'AjaxControlToolkit' is undefined

I have searched MSDN forums, and google, and tried many of the solutions, but none have worked. I have tried, EnablePartialRendering="true", and others. Short of rewriting everything and changing the workflow of my application, is there any way to find the root cause of this, or fix it? ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­

I am using the AjaxControlToolkit in VS2005, and it works fine. I do have some issues though, when I go to some pages I have, then click back, I get this JavaScript error:

'AjaxControlToolkit' is undefined

I have searched MSDN forums, and google, and tried many of the solutions, but none have worked. I have tried, EnablePartialRendering="true", and others. Short of rewriting everything and changing the workflow of my application, is there any way to find the root cause of this, or fix it? ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­

Share Improve this question edited Jul 8, 2017 at 19:17 ɢʀᴜɴᴛ 32.9k15 gold badges121 silver badges114 bronze badges asked Sep 18, 2008 at 21:31 ScaleOvenStoveScaleOvenStove 7601 gold badge7 silver badges11 bronze badges 3
  • I was getting the same error on a page which used AjaxControlToolkit.CalendarBehavior to dynamically add the Calendar Extender control (and related controls) in JavaScript. The link below about switching to Sys.Extended.UI.CalendarBehavior solved my issue – DaveD Commented Apr 16, 2012 at 15:00
  • In my case the problem was that I used asp:ScriptManager. Using ajax:ToolKitScriptManager solved the problem. – Tillito Commented Jan 24, 2014 at 11:25
  • Tilito solution solved this issue for me. – Doreen Commented May 9, 2014 at 18:49
Add a comment  | 

6 Answers 6

Reset to default 7

I got this problme fixed but not by setting CombineScripts="false" but by using the solution described in this post.

There have been some changes in the latest version, due to which you have to use Sys.Extended.UI.BehaviorBase instead of AjaxControlToolkit.BehaviorBase in the registerClass call.

To get around this 'AjaxControlToolkit' is undefined Error, you may also want to ensure that you have CombineScripts set to false in your ToolkitScriptManager configuration. This can be found in your Master page and this solution has worked for me.

<myTagPrefix:ToolkitScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" EnablePartialRendering="true" SupportsPartialRendering="true" **CombineScripts="false"**>

Note you will want to change myTagPrefix to the tagprefix you are using for AjaxControlToolkit. This is usually defined in asp at the top of an aspx file like this...

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="myTagPrefix" %>

This may be a silly question, but did you double check to make sure you have the toolkit reference at the top of your aspx file?

(Adding from comment for ease of reading)

Try adding this to your web.config

<system.web.extensions>
    <scripting>
        <scriptResourceHandler enableCompression="false" enableCaching="false" />
    </scripting></system.web.extensions>

Is that a javascript error?

I suppose it has to do with back-button support in the toolkit.

And undefined errors mostly occurs because somehow the script that contains "AjaxControlToolkit" doesn't gets properly loaded.

Thing that come to mind:

  • The order scripts get loaded, does the Toolkit gets priority?
  • When there are errors in any of the loaded scripts all the other scripts that hasn't loaded yet will simply be canceled and not gets loaded.

See the outputted HTML of the problem page, find links to all the AXD files and make sure you can download them and see valid javascripts inside.

And if you don't already, get Firefox and Firebug and you should be able to trace to the actual script line that emits the error.

Hope this helps.

As [CodeRot] said you need to ensure you have all the AJAX web.config extensions in place, this is the most commonly missed point when doing ASP.NET AJAX sites (particularly from VS 2005).

Next make sure that you have a ScriptManager on the page (which I'm guessing you do from the "EnablePartialRendering" mention).

Make sure that you are referencing the AjaxControlToolkit version for your .NET version, it is compiled for both .NET 2.0 and .NET 3.5, and I believe the latest release is only supporting .NET 3.5.

Ensure that you're getting the Microsoft AJAX Client Library added to the page (that you're not getting any errors about "Sys" missing).

Ensure that you a registering the AjaxControlToolkit in either your ASPX, ASCX or web.config.

If nothing still hasn't worked out for you. Verify that you are not caching this ascx/aspx. Remove the OutputCache declaration.

发布评论

评论列表(0)

  1. 暂无评论