Click here to Skip to main content
15,860,859 members
Articles / Web Development / ASP.NET
Tip/Trick

Improve in AJAX response.

Rate me:
Please Sign up or sign in to vote.
4.71/5 (7 votes)
23 May 2010CPOL1 min read 13K   3  
ToolkitScriptManager
We can improve ajax response by following way.



1)Optimization in ScriptManager

There is a ToolkitScriptManager control in the AJAX Control Toolkit, we can replace the default <asp:scriptmanager> control with this, it supports the ability to dynamically merge multiple client-side Javascript scripts into a single file that is downloaded to the client at runtime. Better yet, only the Javascript needed by the specific controls on the page are included within the combined download, to make it as small as possible.
-we also got about a 50% download speed improvement by only having one request.

XML
<%-- <asp:ScriptManager runat="server" ID="SM1" EnablePageMethods="true" EnablePartialRendering="true"
        ScriptMode="Release" />
--%>
<ajax:ToolkitScriptManager  ID="SM1" runat="server" EnablePageMethods="true"   EnablePartialRendering="true" ScriptMode="Release"
</ajax:ToolkitScriptManager >



There is another property in ScriptManager named EnablePartialRendering, it gets or sets a value that enables partial rendering of a page, which in turn enables you to update regions of the page individually by using UpdatePanel controls.

So, if we using the UpdatePanel in the page, we must set this property to true, conversely, if the UpdatePanel is not using in our page, it would be better that we set the EnablePartialRendering to false.


2)Optimization in Web.config

To optimize the ASP.NET AJAX in our web application, first of all, we need to make sure the Compression and Caching is enabled in our web.config.

-The Caching will saving almost 95% of the network traffic in the second time we request the page.



XML
<system.web.extensions>
<scripting>
<scriptResourceHandler enableCompression="true" enableCaching="true"/>
</scripting>
</system.web.extensions>




These above changes very well worked for me .
i hope this will help you too.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) RadixWeb India
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --