Difference Between Postback VS Asynchronous postback UpdatePanel

Introduction
 
UpdatePanel is used in asp.net for doing partial postback. suppose you are having a page and you want some portion of that page to be refreshed or changed, so in that case why refresh the whole page. in this scenario we may use UpdatePanel and the control inside that UpdatePanel will get refreshed or changed not the full page(if we want to refresh the whole page then we can do that also).

UpdatePanel can have two child elements:

  • ContentTemplate
  • Trigger
ContentTemplate is used to hold the content of the page means suppose we designed page with some controls we will place controls inside of the ContentTemplate
 
Triggers we used in a situation like need to refresh UpdatePanel only whenever I click some button control in that situation I will define those controls with this Triggers child tag.
 
Ajax UpdatePanel contains property called UpdateMode this property is used to specify whether UpdatePanel is always refreshed during a partial render or if it refresh only when a particular trigger hit. By default updatepanel contains UpdateMode="Always" if we want to set it conditionally we need to change this property UpdateMode="Conditional".
 
We can use update panel as follow in our code
  1. <asp:UpdatePanel ID="UpdatePanel2" runat="server"  
  2. UpdateMode="Conditional">  
  3. <ContentTemplate>  
  4. <asp:Label ID="Label2" runat="server"  
  5. ForeColor="red" />  
  6. ……………………………………………………..  
  7. ………………………………………………………  
  8. ……………………………………………………….  
  9. </ContentTemplate>  
  10. <Triggers>  
  11. <asp:AsyncPostBackTrigger ControlID="Button1"  
  12. EventName="Click" />  
  13. </Triggers>  
  14. </asp:UpdatePanel>  
Again Trigger are divided into 2 groups:
  • AsyncPostBackTrigger
  • PostBackTrigger
The main difference between these 2 trigger are:
 
Asynchronous Postback triggers update the page partially without refreshing the whole page (AJAX).
 
Postback triggers update the complete page caused by complete post of the page to the server.