Minimizing the size of Script - Microsoft AJAX Library and ASP.NET 2.0 AJAX Extensions

Originally pulled from:  http://morewally.com/cs/blogs/wallym/archive/2006/10/20/432.aspx

To minimize the size of script, make sure that you turn off partial rendering(UpdatePanel support) if it is not needed.  This means setting the EnablePartialRendering property to false.  This can save significant script being sent to the browser. 

I have also been setting the ScriptMode to release to send down the minimum amount of script with no wasted space in the code. This can be helpful if you want to experiment, otherwise, you probably want to leave it set to Auto.

If you suggest some other things, add them in as a comment.

2 Comments

  • The post is incorrect for the correct reasons. Turning off partial rendering doesn't mean that less script is being sent to the browser - what it means is that the page will still perform a full postback. The odds are over the course of the lifetime of the user experience if in partial rendering mode (and client' broswer cache enabled) that less will be transferred between server and client.

    Partial rendering set to false merely indicates that full postbacks occur which means all of the viewstate etc gets transffered back and forth between server and client.

  • By setting EnablePartialRendering to false, there is less script sent to the browser from the server. This was confirmed by performing by viewing the source and checking the size of the scripts that are sent with both settings.

    The problem you are seeing may be two fold:
    1. The EnablePartialRendering defaults to true.
    2. Even if you set EnablePartialRendering to false, the value is not obeyed if the page contains an UpdatePanel.

Comments have been disabled for this content.