Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I am trapped in the UpdatePanel trap

I have a very big problem. I am making a CRM (Costumer Relationship Management) System in ASP.NET 3.5

I have based my entire project on DevExpress.com controls and the use of UpdatePanels.

Now one of my pages, which is a central page in the whole system, contains a very big amount of possibilities and therefore a big amount of UserControls.

Now my problem is that it's getting really really slow because of the fact that UpdatePanels are reposting the entire page and not only the update panel. We are talking sometime 3-4 seconds before a popup window appears :(

Is there any way I can refactor this entire system away from UpdatePanels without breaking my neck? Are there anyway I can optimize my use of UpdatePanels?

The ViewState is also absolutely giant.

Any good ideas are welcome...

like image 239
The real napster Avatar asked Jun 30 '09 15:06

The real napster


2 Answers

There's no way to get around posting the entire page using UpdatePanels. In lieu of redesigning the app here are a couple things I'd try:

  1. Disable viewstate for any controls that don't need it
  2. Set the UpdateMode="Conditional" for your user controls. This won't get around posting the entire page but it will cut down on rendering time a little. Only the content for the specific UpdatePanel will be updated in the browser.
  3. Make sure your user controls have short IDs. The way ASP.NET webforms names controls in the html these IDs get repeated quite a bit if you have a lot of server controls. Same goes for naming master page placeholders. I once cut a large page to half the size by renaming user controls and placeholders.
like image 73
joshb Avatar answered Oct 13 '22 01:10

joshb


Since you're a DevExpress user, you might consider taking a little time to learn their CallbackPanel which will allow you to do asynchronous processing without the overhead of the UpdatePanel.

Alternatively (someone please correct me if I'm wrong) but if all of the postbacks are asynchronous (i.e. in an UpdatePanel), wouldn't it be theoretically possible to disable ViewState for the entire page (in the Page directive) without negative consequences? You'd have to test it completely off course, but it's worth a shot.

like image 26
Greg Avatar answered Oct 13 '22 02:10

Greg