Why does the Update Panel do a full post back for custom control

asp.netasp.net-ajaxupdatepanel

I have a rather complex custom control – the custom control has a couple of update panels in it.

I am trying to use the control like this inside of an update panel:

    <asp:UpdatePanel ID="up1" runat="server">
    <ContentTemplate>
     <asp:Button ID="btn1" runat="server" Text="Sample Button" />&nbsp;&nbsp;<asp:Label ID="lblTime" runat="server"></asp:Label>    
     <cc1:MyCustomControl ID="MyCustomControl1" runat="server" >
    </cc1:MyCustomControl>
    </ContentTemplate>
</asp:UpdatePanel>

When I click the button in the update panel, it does an async post back and there is no screen "flicker" When I click a button in my custom control the page flickers and does a full post back.

Inside the custom control, there are update panels that are trying to do full postbacks (based on triggers).

How can I make the page level UpdatePanel not do a full postback no matter what is going in inside of the custom control?

Best Solution

Have you thought about explicitly setting an asp:AsyncPostBackTrigger with the btn1 control in the up1 UpdatePanel control.

<asp:UpdatePanel ID="up1" runat="server">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btn1" EventName="Click" />
    </Triggers>
    <ContentTemplate>     
        <asp:Button ID="btn1" runat="server" Text="Sample Button" />  
        <asp:Label ID="lblTime" runat="server"></asp:Label>         
        <cc1:MyCustomControl ID="MyCustomControl1" runat="server" />                 
    </ContentTemplate>
</asp:UpdatePanel>

Edit: How you tried to explicitly call the Update method in the button's OnClick event for the Update Panel? This includes the Update panels embedded within the custom control.

Related Question