I got trapped in UpdatePanel

I have a very big problem. I am making a Costumer Relationship Management system in ASP.NET 3.5

I based my entire project on DevExpress.com controls and using UpdatePanels.

Now one of my pages, which is the central page in the whole system, contains a very large number of features and, therefore, a large number of UserControls.

Now my problem is that it is really very slow due to UpdatePanels recompiling the whole page, not just the update panel. We speak after 3-4 seconds before the popup appears: (

Is there a way to reorganize this whole system from UpdatePanels without breaking my neck? Anyway, can I optimize the use of UpdatePanels?

ViewState is also absolutely gigantic.

Any good ideas are welcome ...

+6
updatepanel
source share
5 answers

It is not possible to bypass publishing an entire page using UpdatePanels. Instead of redesigning the application, here are a few things I would try:

  • Disable viewstate for any controls that it does not need.
  • Set UpdateMode = "Conditional" for custom controls. This will not bypass the publication of the entire page, but it will slightly reduce the rendering time. Only content for a specific UpdatePanel will be updated in the browser.
  • Make sure your user control has short identifiers. As ASP.NET manages web form names in html, these identifiers are repeated quite a lot if you have many server controls. The same applies to entries on the main name page. I once cut a large page into half the size by renaming user controls and placeholders.
+8
source share

Since you are a DevExpress user, you might consider spending some time learning about CallbackPanel , which will allow you to do asynchronous processing without UpdatePanel overhead.

Alternatively (someone, please correct me if I am wrong), but if everything for postbacks is asynchronous (i.e. in UpdatePanel), it would theoretically be impossible to disable ViewState for the whole page (in the page directive) without negative consequences ? You will need to fully test it, but it's worth it.

+2
source share

You will have to replace some of the backlinks contained in your update panels with real AJAX calls, that is, send only the data necessary for the action to the server, and return only what is necessary to update the view, get rid of the postback and UpdatePanels.

(You'll notice my use of the terms action and performance β€” yes, I'm a fan of MVC. The situation you're in is typical of a mess that easily penetrates WebForms and ASP. NET AJAX controls.)

0
source share
  • Something is missing for me. Why does your updated panel reload the entire page. The update point is to update only what is on this panel, right? Thanks for the explanation. I think we are talking about reprogramming the page, not about remaking the panel as I thought.

  • Try disabling ViewState, especially for meshes.

  • What type of management is most common on your page? Try replacing them with your own lightweight UserControl or Server Control that doesn't use ViewState or ControlState
0
source share

For all Interested, I want to add a solution on how to get rid of Viewstate data on clientide. This gives the server additional load, but if you are in the same situation as me and you have a lot of server power and you need to take the load on the client, it’s nice.

Let all your pages be derived from BasePage.cs, which look like this

public class BasePage : System.Web.UI.Page { protected override void SavePageStateToPersistenceMedium(object viewState) { string vsKey = String.Format("VIEWSTATE_{0}_{1}_{2}", base.Session.SessionID, Request.RawUrl, DateTime.Now); Session.Add(vsKey, viewState); ClientScript.RegisterHiddenField("__VIEWSTATE_KEY", vsKey); } protected override object LoadPageStateFromPersistenceMedium() { string vsKey = Request.Form["__VIEWSTATE_KEY"]; return Session[vsKey]; } } 

Now you have the key to the viewstate data session instead of the view in your code ...

Works like a charm for me on a site with 1000-1200 daily visitors.

0
source share

All Articles