0

我在 masterpage 中使用 scriptManager,因为每个内容页面都是 ajxify。

在内容页面中,我使用UpdatePanel并且一切正常,但是在我使用的内容页面的情况下TabCOntainer,每次当我从一个选项卡移动到另一个选项卡时,页面都是完整的回发。

在这里,我注意到一件事,当我ScriptManager从母版页中删除并在其中使用时,它contentPage可以tabContainer正常工作。

这种类型的条件有什么可能的解决方案?

母版

  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 <html xmlns="http://www.w3.org/1999/xhtml">

 <head id="Head1" runat="server">
 </head>

 <body>

   <form id="form1" runat="server">

  <asp:ScriptManager ID="ScriptManager1" runat="server">
   </asp:ScriptManager>

 <asp:UpdatePanel ID="UpdatePanel_Register" runat="server">
     <ContentTemplate>
        //Update Panel work at Master Page
      </ContentTemplate>
</asp:UpdatePanel>


           <asp:ContentPlaceHolder ID="showcase" runat="server">

            </asp:ContentPlaceHolder>

内容页

 <%@ Page Title="" Language="C#" MasterPageFile="~/MasterDashBoard.master" AutoEventWireup="true"
CodeFile="messages.aspx.cs" Inherits="messages" %>

  <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>


  <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

   <asp:UpdatePanel ID="UpdatePanel_msg" runat="server" >

      <ContentTemplate>

        <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" AutoPostBack="True"
                        OnActiveTabChanged="TabContainer1_ActiveTabChanged">

           <cc1:TabPanel runat="server" HeaderText="TabPanel1" ID="TabPanel1" ToolTip="Compose Message">

               <HeaderTemplate>
                                Compose
               </HeaderTemplate>

               <ContentTemplate>
                        Some Work

               </ContentTemplate>

   </cc1:TabPanel>

       <cc1:TabPanel runat="server" HeaderText="TabPanel2" ID="TabPanel2">

                <HeaderTemplate>
                                inbox
                </HeaderTemplate>

                 <ContentTemplate>
            SOme Work
                 </ContentTemplate>
        </cc1:TabPanel>

      </cc1:TabContainer>
    </ContentTemplate>
 </asp:UpdatePanel>

4

1 回答 1

1

我有一个类似的用例和 set UpdateMode="Conditional"ChildrenAsTriggers="true"AsyncPostbackTriggers用于ActiveTabChanged事件。在ActiveTabChanged事件处理程序中,我切换包含控件的可见性并调用Update相应的 UpdatePanel,最后调用周围的UpdatePanel。这还允许通过仅在需要时加载它们的内容来延迟加载选项卡。

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    </asp:ScriptManagerProxy>
    <div>
        <asp:UpdatePanel ID="UpdTabContainer" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
            <ContentTemplate>
                <asp:TabContainer ID="TabContainer1" runat="server" AutoPostBack="true">
                    <asp:TabPanel ID="TabDeliveryControl" runat="server" HeaderText="Delivery-Control">
                        <HeaderTemplate>
                            <asp:Panel ID="PnlTabDeliveryControl" runat="server" ToolTip="Delivery-Control">
                                Delivery-Control
                            </asp:Panel>
                        </HeaderTemplate>
                        <ContentTemplate>
                            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <SVCS:SVCSDeliveryControl id="SVCSDeliveryControl" runat="server" Visible="false" />
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="TabContainer1" EventName="ActiveTabChanged" />
                                </Triggers>
                            </asp:UpdatePanel>
                        </ContentTemplate>
                    </asp:TabPanel>
                    <asp:TabPanel ID="TabRepair" runat="server" HeaderText="Repair-Area" >
                        <HeaderTemplate>
                            <asp:Panel ID="PnlTabRepair" runat="server" ToolTip="Repair-Area">
                                Repair-Area
                            </asp:Panel>
                        </HeaderTemplate>
                        <ContentTemplate>
                            <asp:UpdatePanel ID="UpdatePanel4" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <SVCS:SVCSRepair id="SVCSRepair" runat="server" Visible="false" />
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="TabContainer1" EventName="ActiveTabChanged" />
                                </Triggers>
                            </asp:UpdatePanel>
                        </ContentTemplate>
                    </asp:TabPanel>
                    <asp:TabPanel ID="TabShipping" runat="server" HeaderText="Shipping" Visible="false">
                        <HeaderTemplate>
                            <asp:Panel ID="PnlTabShipping" runat="server" ToolTip="Shipping">
                                Shipping
                            </asp:Panel>
                        </HeaderTemplate>
                        <ContentTemplate>
                            <asp:UpdatePanel ID="UpdatePanel5" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <SVCS:SVCSShipping id="SVCSShipping" runat="server" Visible="false" />
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="TabContainer1" EventName="ActiveTabChanged" />
                                </Triggers>
                            </asp:UpdatePanel>
                        </ContentTemplate>
                    </asp:TabPanel>
                </asp:TabContainer>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>
于 2012-05-21T10:57:14.593 回答