DGibbs
DGibbs

Reputation: 14618

AjaxControlToolkit combine scripts Sys.Extended.UI undefined

I'm using the out-the-box script combining feature of the ajaxToolkit ToolkitScriptManager e.g:

<ajaxToolkit:ToolkitScriptManager ID="manScript" runat="server" CombineScripts="true"></ajaxToolkit:ToolkitScriptManager>

This works fine, the script resource files are combined which is the desired result however on certain pages, those which make use of the ValidatorCallout, are breaking due to a script reference not being found:

Uncaught TypeError: Cannot read property 'UI' of undefined

Example:

Sys.Application.add_init(function() {
    $create(Sys.Extended.UI.ValidatorCalloutBehavior, {"ClientStateFieldID":"ctl00_ucBookingOverlayForm_vceEmailRfv_ClientState","closeImageUrl":"/WebResource.axd?d=f1QpGIE3tIwIlwHDSgFaMKzu_EDD74IJxTW0wu5XFBsijDtCLxDaIo2PLWkvmpuVhGM3qlhvBO657x4jHl-GgLAybfgjNbFabkTpkICSknrDRSEDk5EuUA23IYRXprVpF1a4fg2\u0026t=636155032911179735","highlightCssClass":"error","id":"ctl00_ucBookingOverlayForm_vceEmailRfv","warningIconImageUrl":"/WebResource.axd?d=J2f54MGVNKrbG7KUyE1UxWfAcESo9_Mj-3_tX4cOIGXtDsrNI96CS2rrIj0oLhO9ioIMaeIGa4hw-cuLd_AbF7V_P4hYubyJCjWCGBeOh8DYw-SCx23Kl5noFRHYQAgpnIVCKOe3QyH3vNqc8QhIYA93_YU1\u0026t=636155032911179735"}, null, null, $get("ctl00_ucBookingOverlayForm_reqLocation"));
});

It's not finding Sys.Extended.UI.ValidatorCalloutBehavior for some reason. I'm guessing the script combining feature doesn't include this script? Because the error is resolved by setting CombineScripts="false", this is no solution though as I need the script combining feature.

I cannot upgrade to a new version of AjaxControlToolkit as the CMS I'm using has a dependency on this specific version (4.1.60919.0).

Upvotes: 1

Views: 1555

Answers (1)

MikhailTymchukDX
MikhailTymchukDX

Reputation: 720

While I can not detect the reason for this behavior, you can try to redirect your old assembly to a new version like this:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="AjaxControlToolkit" publicKeyToken="28f01b0e84b6d53e" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-4.1.60919.0" newVersion="16.1.1.0"/>
        </dependentAssembly>
    </assemblyBinding>
</runtime>

Upvotes: 1

Related Questions