What is Asyncpostbacktrigger Class?

Asked

Viewed 429 times

3

How should I wear and what makes this kind of class?

1 answer

2


Sets an optional control and control event as a control trigger postback assíncrono that makes the control UpdatePanel be updated. Reference Microsoft Developer Network - Asyncpostbacktrigger Class.

Basically, when you use Updatepanel, the controls contained in it has its information updated without giving a refresh on the page, but, there is a technique that when declaring a Asyncpostbacktrigger of some control outside the Updatepanel make this control have the same behavior as those within the Updatepanel.

A example would be the statement in that way:

<form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <asp:Button ID="BtnDateTimeNowUpdate" 
                runat="server" 
                Text="Atualizar" 
                OnClick="BtnDateTimeNowUpdate_Click" />
    <div>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="BtnDateTimeNowUpdate" />
            </Triggers>
            <ContentTemplate>
                <asp:Label ID="LblDateTimeNow" runat="server" Text=""></asp:Label>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</form>

in this simple code, note that the button BtnDateTimeNowUpdate is out of the Updatepanel, but, it has the same behavior as if it were within it by the simple configuration present in Updatepanel:

<Triggers>
    <asp:AsyncPostBackTrigger ControlID="BtnDateTimeNowUpdate" />
</Triggers>

if this setting were not so, this button would give a refresh on the full page that is the normal behavior for Webform.

Can be used when a control outside the Updatepanel, have to interact with the controls within the Updatepanel.

References

Browser other questions tagged

You are not signed in. Login or sign up in order to post.