显示多个选项卡上的公共控件而不会丢失控件的状态C#

时间:2016-09-16 02:55:49

标签: c# jquery css asp.net c#-4.0

我在Tab容器中有三个选项卡面板

<ajax:TabContainer ID="tabContainer" runat="server"   OnActiveTabChanged="tabContainer_ActiveTabChanged" AutoPostBack="true">

<ajax:TabPanel runat="server" ID="tabPanel1" TabIndex="1" HeaderText="tabPanel1HeaderText"></ajax:TabPanel>

<ajax:TabPanel runat="server" ID="tabPanel2" TabIndex="2" HeaderText="tabPanel2HeaderText" visible="false">
some commone controls</ajax:TabPanel>

<ajax:TabPanel runat="server" ID="tabPanel3" TabIndex="3" HeaderText="tabPanel3HeaderText"></ajax:TabPanel>

</ajax:TabContainer>

我正在尝试使用tabPanel2作为我的虚拟列,在tabPanel1和tabPanel3上的tabPanel2上显示常用控件,如下所示

string tab = tabContainer.ActiveTab.HeaderText;
        switch (tab)
        {
            case "tabPanel1.HeaderText":

                tabPanel2.Visible = true;
                tabPanel1.Visible = false;
                tabPanel3.Visible = true;

                tabPanel2.HeaderText = "tabPanel1.HeaderText";
                tabContainer.ActiveTabIndex = tabPanel2.TabIndex;
                break;

            case "tabPanel3.HeaderText":
                tabPanel2.Visible = true;
                tabPanel1.Visible = true;
                tabPanel3.Visible = false;

                tabPanel2.HeaderText = "tabPanel3.HeaderText";
                tabContainer.ActiveTabIndex = tabPanel2.TabIndex;
                break;

             }

现在我有另一个标签面板

    <ajax:TabPanel runat="server" ID="tabPanel4" TabIndex="4" HeaderText="tabPanel4HeaderText"></ajax:TabPanel>

我想在tabPanel4上显示tabePanel2控件。有没有办法使用可见性来使tab2显示在tab1,tab3和tab4的相同位置,方法是使这些相应的选项卡不可见?

0 个答案:

没有答案