1

I am using ajax toolScriptManager since I've used update panel, calendar and mask extender. But when I observe the network instances the ToolScriptManager generates four javascripts files which are too large in size (355 KB) which really affecting the sites loading time without cache (when opened first time in browser). As I am using only update panel, calendar extender and mask extender still the size of script generated is too large and also generating the 4 scripts (which also causing four round trip requests).

Is there any way to generate only those js required by the extenders used in page. Also, Is it possible to compress ToolScriptManager's scripts using GZip and combine all js in one reference to reduce the http request.

Currently my TookScriptManager is as below:

<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" LoadScriptsBeforeUI="false" ScriptMode="Release">
        </asp:ToolkitScriptManager>

I strongly believe that optimizing ToolScriptManger will improve my sites performance. Your suggestions will be great help for me.

Thanks in advance. enter image description here

Rhushikesh
  • 3,630
  • 8
  • 45
  • 82

1 Answers1

0

If you are using Ajax Control toolkit released in July 2013 or later then you will have ability to specify controls bundles. For more information about how to use controls bundles se e introducing control bundles post.

If version of the Ajax Control toolkit you use is before July 2013 then ensure that you specify to combine scripts for ToolkitScriptManager:

<ajaxToolkit:ToolkitScriptManager ID="toolkitScriptMaster" runat="server" CombineScripts="True">
</ajaxToolkit:ToolkitScriptManager>

Other option is that you can use standard ScriptManager control instead of ToolkitScriptManager (this depends on version of the Ajax Control Toolkit library and ASP.NET). Standard script manager has ability to combine scripts using composite script collection. This feature is more flexible and it is more easy to control how scripts are combined on your pages. For example:

<asp:ScriptManager ID="scriptManager" runat="server" EnablePartialRendering="true">
    <CompositeScript ScriptMode="Release">
        <Scripts>
            <asp:ScriptReference Name="MicrosoftAjax.js" Assembly="AjaxControlToolkit"/>
            <asp:ScriptReference Name="MicrosoftAjaxWebForms.js" Assembly="AjaxControlToolkit"/>
            <asp:ScriptReference Name="Compat.Timer.Timer.js" Assembly="AjaxControlToolkit"/>
            <asp:ScriptReference Name="Animation.Animations.js" Assembly="AjaxControlToolkit"/>
            <asp:ScriptReference Name="Animation.AnimationBehavior.js" Assembly="AjaxControlToolkit"/>
            <asp:ScriptReference Name="DynamicPopulate.DynamicPopulateBehavior.js" Assembly="AjaxControlToolkit"/>
            <asp:ScriptReference Name="Compat.DragDrop.DragDropScripts.js" Assembly="AjaxControlToolkit"/>
            <asp:ScriptReference Name="DragPanel.FloatingBehavior.js" Assembly="AjaxControlToolkit"/>
            <asp:ScriptReference Name="RoundedCorners.RoundedCornersBehavior.js" Assembly="AjaxControlToolkit"/>
            <asp:ScriptReference Name="DropShadow.DropShadowBehavior.js" Assembly="AjaxControlToolkit"/>
            <asp:ScriptReference Name="ModalPopup.ModalPopupBehavior.js" Assembly="AjaxControlToolkit"/>
        </Scripts>
    </CompositeScript>
</asp:ScriptManager>

More information can be found using the following link: ASP.NET 4.0 Script Manager Improvements.

Also, note that as far as I remember if you using ToolkitScriptManager then you will not be able to use CompositeScript feature, even to take in account that the ToolkitScriptManager derives from ScriptManager.

Maxim Kornilov
  • 5,675
  • 1
  • 24
  • 35