简体   繁体   English

母版页中contentplaceholder之外的更新面板导致回发到内容页

[英]An updatepanel outside of contentplaceholder in master page causes post back to content page

I have something like this in my Master Page: 我的母版页上有这样的内容:

    <asp:UpdatePanel ID="uppnlUtilities" runat="server" UpdateMode="Conditional">
    <Triggers>
        <asp:AsyncPostBackTrigger  ControlID="Timer1" EventName="Tick" />
    </Triggers>
    <ContentTemplate>
        <asp:Panel ID="pnlTopUtilities" runat="server">
            <asp:HyperLink ID="lnkCheckUpdates" runat="server" ImageUrl="~/images/viewupdates.gif" NavigateUrl="~/CheckUpdates.aspx" CssClass="imagelink"></asp:HyperLink>
            <asp:HyperLink ID="lnkAlertArchive" runat="server" ImageUrl="~/images/AlertArchives.gif" NavigateUrl="~/AlertArchive.aspx" 
                CssClass="imagelink" Visible="true"></asp:HyperLink>
            <asp:HyperLink ID="lnkNewAlert" runat="server" ImageUrl="~/images/AlertWaiting.gif" NavigateUrl="~/NewAlerts.aspx" 
                onclick="window.open (this.href, 'popupwindow', 'width=400,height=300,scrollbars,resizable'); return false;"
                CssClass="imagelink" Visible="false"></asp:HyperLink>
        </asp:Panel>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:Timer ID="Timer1" runat="server" Interval="10000" OnTick="Timer1_Tick"></asp:Timer>

..........
.........
div id="divBody" class="group">
    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
    </asp:ContentPlaceHolder>
</div>

I do see the partial post back within master page, but I also see the post back in content pages. 我的确在母版页中看到了部分回发,但在内容页中也看到了回发。 When I put a break point on page_load, in content page, the code execution hits it. 当我在内容页面的page_load上放置一个断点时,代码执行就会命中它。 Any help is appreciated. 任何帮助表示赞赏。 Thanks! 谢谢!

The update panel does not change the postback. 更新面板不会更改回发。 The page will go through its entire lifecycle. 该页面将贯穿其整个生命周期。 The difference an update panel makes is that the postback is asynchronous and only the content of the update panel is rendered. 更新面板的不同之处在于回发是异步的,并且仅呈现更新面板的内容。

Here is the relevant quote from MS Description of the UpdatePanel 这是MS UpdatePanel说明中的相关报价

When partial-page updates are enabled, controls can asynchronously post to the server. 启用部分页面更新后,控件可以异步发布到服务器。 An asynchronous postback behaves like a regular postback in that the resulting server page executes the complete page and control life cycle. 异步回发的行为类似于常规回发,因为生成的服务器页面执行完整的页面并控制生命周期。 However, with an asynchronous postback, page updates are limited to regions of the page that are enclosed in UpdatePanel controls and that are marked to be updated. 但是,使用异步回发,页面更新仅限于UpdatePanel控件中包含并标记为要更新的页面区域。 The server sends HTML markup for only the affected elements to the browser. 服务器仅将受影响的元素的HTML标记发送到浏览器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM