Similar Topics...
 |
ajaxtoolkit:ToolkitScriptManager has terrible performance The ajaxtoolkit:ToolkitScriptManager has terrible performance out of the box. It loads fifty+ .js files that enable you to drop any AJAX control you want on the page. If you are only using one control on your page, this is a waste. In addition, it is buggy with Debug=Release in your web.config; Page PreRender gets called twice unless you explicitly set CombineScripts=False. Here is what to do: 1. Enable caching in web.config <system.web.extensions> <scripting> <scriptResourceHandler enableCaching="true"/> </scripting> </system.web.extensions> There is an option here to enable compression - leave it off or your site won't work on IE6. 2. On your page that uses the AJAX ToolKit, get rid of the ajaxtoolkit:ToolkitScriptManager. Replace it with an asp:ScriptManager. NOTE: this only works in .NET3.5+. If you have lower than that, you must use the ToolkitScriptManager and manually implement the CombineScripts operation. a. If your page does NOT have an asp:UpdatePanel, set EnablePartialRendering to false to improve load time. If you are using an UpdatePanel, you should leave the default (true). b. Set LoadScriptsBeforeUI to false to improve load time c. Set ScriptMode to Release to improve load time d. Inside the ScriptManager, in the CompositeScript tag, list all of the AJAX .js scripts you need to load. This should be based on whatever AJAX controls you are using in the page. Here is the final ScriptManager code, in this case with the scripts needed for an ajax AutoCompleteExtender TextBox. <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="false" ScriptMode="Release" LoadScriptsBeforeUI="false" AsyncPostBackTimeout="9999999"> <CompositeScript> <Scripts> <asp:ScriptReference Name="MicrosoftAjax.js" /> <asp:ScriptReference Name="MicrosoftAjaxWebForms.js" /> <asp:ScriptReference Name="Compat.Timer.Timer.js" Assembly="AjaxControlToolkit, Version=4.1.7.1213, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" /> <asp:ScriptReference Name="Common.Common.js" Assembly="AjaxControlToolkit, Version=4.1.7.1213, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" /> <asp:ScriptReference Name="ExtenderBase.BaseScripts.js" Assembly="AjaxControlToolkit, Version=4.1.7.1213, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" /> <asp:ScriptReference Name="AutoComplete.AutoCompleteBehavior.js" Assembly="AjaxControlToolkit, Version=4.1.7.1213, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" /> <asp:ScriptReference Name="PopupExtender.PopupBehavior.js" Assembly="AjaxControlToolkit, Version=4.1.7.1213, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" /> </Scripts> </CompositeScript> </asp:ScriptManager> The page now loads in a fraction of the time, and the AutoCompleteExtender TextBox still works.
Created By: amos 3/11/2014 4:54:03 PM Updated: 3/14/2014 10:43:22 AM
|
|
|
|
|
|