15 January 2011

Asp.net Update Panel

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.

UpdatePanel have two important properties
1.UpdateMode 2.ChildrenAsTrigger

1.UpdateMode
Has 2 possible values:

*Always(Default one)
 When set to Always, the UpdatePanel is updated on every postback(both full and partial) raised from anywhere in the page(may be from controls inside the panel, inside other panels  or just on the page).
*Conditional
 When set to Conditional, the UpdatePanel will be updated only on 
-->postback originated by controls inside the same panel
-->from the triggers specified 
-->when the parent get updated in case of nested update panels.

2.ChildrenAsTrgger

*Applicable only when UpdateMode is conditional.
*Attempting to do so without  UpdateMode is set  conditional  results in an InvalidOperationException being thrown by the ScriptManager during the page’s PreRender event.
*Possible values
 -->true  - Update Panel will be updated when the postback is
                generated by the controls inside the same panel.(Its the default one)
 -->false - Update Panel will not be updated when the postback is generated
                by the controls inside the same panel unless it is specified in             
                trigger, or Parent update panel is not getting updated