"AjaxControlToolkit is undefined"

Because we were still using an old Visual Studio 2005 solution which included a Web Site project, it was time to upgrade. We upgraded our Visual Studio 2005 solution to Visual Studio 2010 (and .NET 4.0), converted the Web Site Project to a Web Application Project and then, of course, the AjaxControlToolkit had to follow. I downloaded the latest build from their Codeplex site and updated the references in the different projects. I ran the website, and that’s where things got ugly…

Most pages worked nicely, but there were a few that gave an “AjaxControlToolkit is undefined” error. I removed all references to the AjaxControlToolkit, removed all the old versions of it from my machine, referenced the most recent version again, all to no avail. After Googling* Binging the error I found a LOT of possible solutions. These included:

  • Use the ToolkitScriptManager from the AjaxControlToolkit in stead of the built-in ScriptManager
  • When using the ToolkitScriptManager, set CombineScripts to false
  • When using the ToolkitScriptManager, set EnablePartialRendering to true
  • Clear the browser cache
  • Clear the ASP.NET Temporary Files directory
  • Use a (dummy) control to make sure the JavaScript files have been loaded correctly

Unfortunately, none of these possible solutions helped us with our specific problem. Our problem occurred when we, for instance, set the PositioningMode for a control from custom JavaScript using the AjaxControlToolkit.PositioningMode enumeration. The error was always from custom JavaScript. After looking around a bit more I found one site that mentioned something about changing the AjaxControlToolkit ‘namespace’ in JavaScript.  After playing around a bit I found out that changing the use of AjaxControlToolkit.XXX to System.Extended.UI.XXX provided the solution.

Hope this helps.

* Of course this is a weak attempt at a joke, but fact is that Google (the first 7 or so pages) only pointed me in the direction of the solutions that weren’t solutions for my situation. When I tried Bing for a change, I found something that put me on the right track pretty fast. Kudos to Bing!

Comments

# re: "AjaxControlToolkit is undefined"

Wednesday, September 29, 2010 3:56 PM by JJ

Hey Can you change your namespace from System.Extended.UI.XXX to Sys.Extended.UI.XXX? In javascript, you use Sys instead of System. I got it working after adjusting this change. Thanks for posting this.

# re: "AjaxControlToolkit is undefined"

Friday, November 05, 2010 6:41 PM by Kostis Mamassis

Guys, this issue will usually appear in custom controls that depend on Ajax and especially when you upgrade (the reason is because you have to change one line of JS code as explained below).

I upgraded from Ajax v.2 to v.4 and went through a bit of hell until I found out this thread and realized that I had to edit the JS that comes with the custom controls (source code needed) and change the last line FROM:

Tooltip.TooltipBehavior.registerClass('Tooltip.TooltipBehavior', AjaxControlToolkit.BehaviorBase);

TO:

Tooltip.TooltipBehavior.registerClass('Tooltip.TooltipBehavior', Sys.Extended.UI.BehaviorBase);

and then rebuild. The new dll is the one we'll have to copy to the bin folder of our application and then reference it in the web.config

hope that helps!

# re: "AjaxControlToolkit is undefined"

Tuesday, June 28, 2011 12:45 PM by Alexander M. Batishchev

Confirm that changing AjaxControlToolkit.BehaviorBase to Sys.Extended.UI.BehaviorBase works fine for ACTK 4.1

# re: "AjaxControlToolkit is undefined"

Tuesday, August 23, 2011 1:29 PM by Rupendra Bensh

Sys.Extended.UI.XXX

work fine instead of AjaxControlToolkit.XXX

# re: "AjaxControlToolkit is undefined"

Tuesday, January 24, 2012 2:22 AM by Jeremy E

Thanks Kostis, followed your advice on a custom control for asp.net that used javascript, changed

AjaxControlToolkit.XXX

to

Sys.Extended.UI.XXX

in one line of code, and now the control works.

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Please add 4 and 7 and type the answer here: