How AsyncPostBackTrigger and PostBackTrigger works in ASP.Net

Last Reply 7 months ago By dharmendr

Posted 7 months ago

how postback trigger and asynchronous postback trigger works in the code

When i clicked on click button,both time Page Generated @ 11:23:00 AM Internal @ 11:23:00 AM when i clicked on async button,one time changed ie. Asych click @ 11:25:45 AM what is exactly happening.. I am just confused with the Page load. in both the cases,postbacktrigger and asyncpostbacktrigger.Is it loading the whole page?

i am referring the below code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
            Page Generated @ 
            <asp:Label runat="server" ID="uiPageTime" />
            <p />
            <asp:UpdatePanel runat="server" ID="update" UpdateMode="Conditional">
                    <asp:Label runat="server" ID="uiTime" />
                    <asp:Button runat="server" ID="uiInternalButton" Text="Click" />
                    <asp:AsyncPostBackTrigger ControlID="uiAsynch" EventName="click" />
                    <asp:PostBackTrigger ControlID="uiInternalButton" />
            <asp:Button runat="server" ID="uiPostback" Text="Click" />
            <asp:Button runat="server" ID="uiAsynch" Text="Asynch" />


public partial class _Default : System.Web.UI.Page
    protected void Page_Init(object sender, EventArgs e)
        uiAsynch.Click += uiAsynch_Click; uiPostback.Click += uiPostback_Click;
        uiInternalButton.Click += uiInternalButton_Click;
    protected void Page_Load(object sender, EventArgs e)
        uiPageTime.Text = DateTime.Now.ToLongTimeString();
        if (!IsPostBack)
            uiTime.Text = DateTime.Now.ToLongTimeString();

    private void uiInternalButton_Click(object sender, EventArgs e)//postbacktriger
        uiTime.Text = "Internal @ " + DateTime.Now.ToLongTimeString();
    private void uiPostback_Click(object sender, EventArgs e)
        uiTime.Text = "Postback click @ " + DateTime.Now.ToLongTimeString();
    private void uiAsynch_Click(object sender, EventArgs e)//asynchronuspostbacktrigger
        uiTime.Text = "Asych click @ " + DateTime.Now.ToLongTimeString();


You are viewing reply posted by: dharmendr 7 months ago.
Posted 7 months ago


PostBackTrigger does full postback.

AsyncPostBackTrigger does partial postback.