First time here? You are looking at the most recent posts. You may also want to check out older archives or the tag cloud. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS. Thank you for visiting! (hide this)

Since the cool thing about the ASP.NET Ajax UpdatePanel is that its contents are updated asynchronously when an event that would normally generate a postback is raised inside, one would think that this is its default behavior.

But it's not: the UpdateMode property of the UpdatePanel has 2 possible values:

  • Always
  • Conditional

and the default value is Always.

When set to Always, the UpdatePanel is updated on every postback raised from anywhere in the page, so from controls inside the panel, inside other panels or just on the page.

When set to Conditional, the UpdatePanel will be updated only on postback originated by controls inside the panel or from the triggers specified.

So, if you have multiple update panels and you don't want to update all of them to be updated every time, you have to set the UpdateMode to Conditional:

<asp:UpdatePanel ID="UpdatePanel1" 
                  UpdateMode="Conditional"
                  runat="server">

I spent all the day trying to understand why it took so long to refresh a small area with only a few labels, and it was because I didn't set the UpdateMode to Conditional.

I don't understand why the default is Always and not Conditional, but not that I know, it's not a big deal: just have to remember to always set the UpdateMode.

Technorati tags: , ,

posted on Thursday, May 24, 2007 9:32 PM

Comments on this entry:

# How to refresh an UpdatePanel from javascript

Left by CodeClimber at 6/26/2007 2:57 PM

How to refresh an UpdatePanel from javascript

Comments have been closed on this topic.