Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

One Update Panel vs. Multiple Update Panels [closed]

I have an ASP.NET web page that displays a variety of fields that need to be updated best on certain conditions, button clicks and so on. We've implemented AJAX, using the ASP.NET Update Panel to avoid visible postbacks.

Originally there was only one area that needed this ability ... that soon expanded to other fields. Now my web page has multiple UpdatePanels.

I am wondering if it would be best to just wrap the entire form in a single UpdatePanel, or keep the individual UpdatePanels.

What are the best practices for using the ASP.NET UpdatePanel?

like image 412
mattruma Avatar asked Sep 16 '08 13:09

mattruma


People also ask

Can we use multiple update panel in asp net?

By using multiple UpdatePanel controls on a page, you can incrementally update regions of the page separately or together. For more information about partial-page updates, see Partial-Page Rendering Overview and Introduction to the UpdatePanel Control.

How do update panels work?

UpdatePanel controls are a central part of AJAX functionality in ASP.NET. They are used with the ScriptManager control to enable partial-page rendering. Partial-page rendering reduces the need for synchronous postbacks and complete page updates when only part of the page has to be updated.

What is the purpose of AsyncPostBackTrigger in the update panel?

Use the AsyncPostBackTrigger control to enable controls to be triggers for an UpdatePanel control. Controls that are triggers for an update panel cause a refresh of the panel's content after an asynchronous postback.

Which are the triggers present in update panel?

Triggers for a given UpdatePanel, by default, automatically include any child controls that invoke a postback, including (for example) TextBox controls that have their AutoPostBack property set to true.


2 Answers

Multiple panels are much better. One of the main reasons for using UpdatePanels at all is to reduce the traffic and to only send the pieces that you need back and forth across the wire. By only using one update panel, you're pretty much doing a full post back every time, you're just using a little Javascript to update the page without a flicker.

If there are pieces of the page that need to be updated together, there are ways to trigger other panels to update when one does.. but you should definitely be using multiple update panels.

like image 112
Wayne Avatar answered Sep 21 '22 17:09

Wayne


I'd caution that with multiple update panels you'll want to be careful. Make sure you set the UpdateMode to Conditional. Otherwise, when one update panel is "posted back" to the server, all of them are posted back.

I'd highly suggest using these tools

Web Development Helper (here's a brief tutorial Web Development Helper and ASP.NET Ajax)

Fiddler

like image 24
Jon Avatar answered Sep 17 '22 17:09

Jon