7

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? ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­

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 Commented Apr 16, 2012 at 15:00
  • In my case the problem was that I used asp:ScriptManager. Using ajax:ToolKitScriptManager solved the problem. Commented Jan 24, 2014 at 11:25
  • Tilito solution solved this issue for me. Commented May 9, 2014 at 18:49

6 Answers 6

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.

Sign up to request clarification or add additional context in comments.

1 Comment

where to add this?
3

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" %>

1 Comment

CombineScripts="false" worked for me for nopCommerce 1.9 admin pages.
1

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>

3 Comments

yes its referenced. It works fine if I hit the page directly or from a link, it it just getting this error on back buttons
This may just be a workaround..but it is something to try. Try adding this to your web.config <system.web.extensions> <scripting> <scriptResourceHandler enableCompression="false" enableCaching="false" /> </scripting> </system.web.extensions>
This helped me fix a problem when browsing my site from IE7 hosted on Citrix. The Citrix-based browser was not decompressing scripts properly.
0

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.

2 Comments

like you said, back button issues. have used fiddler/firebug. I can see the errors happening, its not loading all the jscript on the back button, but if you hit the page from a link. Not sure what I can do to get it to load up all the jscript, back button or not, without a rewrite
Ummm... did you use AjaxControlToolkit in other ares other than the back button support?
0

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.

1 Comment

all that is done. This is the most common answer around the web. The AjaxControlToolkit is working fine. It just throws up the jscript error on back button. I am using ajax controls from it and the work just fine otherwise.
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.