Why does the update panel make a complete answer for user control?

I have a rather complicated user control - the user control has several update panels.

I am trying to use such a control inside the 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 on the update panel, it returns an asynchronous post and "screen flicker" does not appear. When I click the button in my custom control, the page flickers and makes the full post back.

Inside the custom control, there are update panels that try to make full callbacks (based on triggers).

How can I do an UpdatePanel at the page level without doing a full postback no matter what happens inside the custom control?

+3
source share
4 answers

Figured out a solution to a similar problem: How can I get an UpdatePanel to intercept DropDownList CompositeControl

Except for my control that caused the postback, an update panel with a full postback trigger was added. I was able to pull out this control so that it is not nested in the update panel and does not allow it.

+1
source

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

<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>

: Update OnClick ? , .

+2

, - , , , , ( ajax).

" Nesting UpdatePanel": http://msdn.microsoft.com/en-us/library/bb398867.aspx#

, ScriptManager EnablePartialRendering true.

0

UpdatePanel ChildrenAsTriggers="true". UpdatePanel PostBack, UpdatePanel.

UpdateMode, , . ( UpdatePanel , - . , , .)

-3

Source: https://habr.com/ru/post/1704301/


All Articles