Click here to Skip to main content
13,409,605 members (41,585 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


17 bookmarked
Posted 29 Dec 2010

How to Improve ASP.NET UpdatePanel Performance

, 29 Dec 2010
Rate this:
Please Sign up or sign in to vote.
How to Improve ASP.NET UpdatePanel Performance

Since ASP.NET AJAX UpdatePanel was first introduced, it has earned a strange mix of reputation. On the one hand, it has become a tool of first choice for many ASP.NET developers who wanted an easy way of introducing an AJAX-like behavior for their ASP.NET web apps. On the other hand, it has earned a lot of criticism from seasoned web developers because of certain performance consequences associated with complex usage scenarios.

Well, everything may be good and may be evil based on how we use it. From my experience, conscious and judicious use of UpdatePanel is the key to saving its benefits and avoiding potential problems.

Below, I suggest a number of rules that help achieving better results when using UpdatePanel.

  • Avoid automatic refreshing of UpdatePanel; always stay in control of which UpdatePanel and when refreshes: set UpdateMode property to Conditional (the default value is Always).
  • Minimize the content of the UpdatePanel: the <ContentTemplate> should only include controls that are necessary to refresh. For instance, if user input requires server-side validation, include only an error message mark-up in the UpdatePanel and leave the rest of the form outside.
  • Try to keep the partial postback trigger controls outside of their respective UpdatePanels unless its necessary to change their markup.
  • Try to stick to a simple rule: one trigger for one UpdatePanel. If you need to refresh multiple UpdatePanels during one request, add a trigger control to only one of those UpdatePanels and refresh the others programmatically in an event handler on the server. The idea is to avoid uncontrollable refreshing of unnecessary UpdatePanels.
  • Since ViewState is updated with every partial postback request, turn the ViewState off on a page that contains the UpdatePanel wherever possible or store the ViewState on the server to avoid transferring it back and forth with every async request.
  • Since Page runs through its lifecycle during every partial postback and executes methods like Page_Load or Page_PreRender, make sure that logic that is unnecessary for refreshing UpdatePanel is not executed by wrapping it in if(!ScriptManager.IsInAsyncPostBack).
  • If you use UpdatePanel event handlers like Init, Load, PreRender and Unload, make sure that code inside these event handlers does not execute unless necessary by checking Page.IsPostBack and ScriptManager.IsInAsyncPostBack properties.
  • If you trigger an UpdatePanel programmatically from the client-side (via JavaScript), make sure that its event handler check for the event trigger value using Request.Params["__EVENTTARGET"] to avoid unnecessary execution path.
  • If you programmatically update Page's Header (Title, etc.) or other Page's content that is outside UpdatePanel, make sure that this code never gets executed during partial postbacks. First of all, it's not necessary since page does not refresh but also it may be dangerous because the content may not be handled properly by a browser.


There may probably be more tricks and tips regarding usage of UpdatePanel, but those mentioned above have been proven by real experience. I would also recommend reading an excellent post by Dave Ward that helps in understanding how UpdatePanel works behind the scenes and never hesitate using Fiddler to investigate what your web app's doing.


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


About the Author

Alexander Turlov
Canada Canada
Alexander Turlov is a professional software development consultant that has been working in IT industry since 1987. His programming experience includes such languages as FORTRAN, Pascal, Basic, C, C++ and C#. He's been working for different industries including but not limited to science, manufacturing, retail, utilities, finance, insurance, health care, education and so on. His area of professional interests is cloud powered rich web applications development with .NET, C#, ASP.NET/MVC and JavaScript. He is working in software development doing architecture, design and development on .NET platform and using Microsoft Visual Studio, Azure and Visual Studio Team Services as his primary tools. He holds a M.Sc. degree in physics and various industry certifications including MCSD.NET, Azure and Scrum.

View my profile on LinkedIn

View my blog

You may also be interested in...

Comments and Discussions

Questionvery good article Pin
a_shyam4128-Apr-17 4:24
membera_shyam4128-Apr-17 4:24 
GeneralMy vote of 4 Pin
ahsan sarfraz24-Jan-11 0:52
memberahsan sarfraz24-Jan-11 0:52 
GeneralMy vote of 4 Pin
lerit_liu5-Jan-11 16:32
memberlerit_liu5-Jan-11 16:32 
GeneralGood one Pin
thatraja31-Dec-10 1:43
memberthatraja31-Dec-10 1:43 
Generalthanks for sharing Pin
Pranay Rana29-Dec-10 19:48
memberPranay Rana29-Dec-10 19:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.180221.1 | Last Updated 29 Dec 2010
Article Copyright 2010 by Alexander Turlov
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid