Just ran into this weird error when trying to add an AJAX control to a web page and we spent a lot of time trying to resolve this.
Basically the web page worked fine but when moving it to the server it generated a client-side JS error: "Microsoft JScript runtime error: 'AjaxControlToolkit' is undefined".
this is the corresponding code:
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.ModalPopupBehavior, {"BackgroundCssClass":"modalBackground", ...}, null, null, $get("btnNew"));
});
Google search did reveal people having similar problems but no good solution.
Then there was some good information in this thread.
Basically it turns out that the the script is being compressed under certain circumstances (like debug mode vs. non-debug) and whether the compression settings are defined in the web.config file.
Here is what fixed it for us. The important setting is the one "enableCompression='false'":
<system.web.extensions>
<scripting>
<scriptResourceHandler enableCompression="false" enableCaching="true">
</scriptResourceHandler >
</scripting>
</system.web.extensions>
Make sure you switch the compression off, since it seems it does not work, even when using IE7 like I do.
2 comments:
You should let readers know that "scriptresourcehandler" is case sensitive and should be "scriptResourceHandler". Same thing applies to "enablecompression" and "enablecaching".
Thanks you for catching this. Fixed.
Post a Comment