Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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

Any of these answers don't mentioned maintainabiliy comparison between the choices. Third options is that you don't use any update panel and leave your self to the reverse ajax. Check out the interesting projects: PokeIn and VisualJS.NET

I believe it is best to use multiple UpdatePanel if you can because of the size the POST that the UpdatePanel generates. It's even better if you can use manual AJAX approaches for small things like updating a field. The WPF provides some javascript functions and methods to accomplish this. Here's some link that may be helpful:

I recommend multiple updatepanels. Using multiple updatepanels will keep alive the true meaning of using updatepanel in asp.net web applications. And since we can even trigger one updatepanel from another updatepanel this makes it easier to code page-wide controls and behaviour.

I completely agree to use Multiple Update Panel rather than to use single update panel,When you want only a certain part to be postbacked if you want entire page to be postback then it is better to use single update panel.

Make sure that you make the updatemode="conditional" for all the updatepanel otherwise all the updatepanel will get refreshed.

Also Check out the below Post for complete usage for update panel

http://www.codeproject.com/KB/aspnet/Select_List_Box.aspx

Not sure about the best practices, but in my experience multiple panels work well, and reduce the amount of data being sent at one time - resulting in an increase in response time overall. Multiple panels also reduce the complexity of each server call.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top