【问题标题】:Using the same asp panel in multiple tabs在多个选项卡中使用相同的 asp 面板
【发布时间】:2008-10-07 15:17:56
【问题描述】:

在 Ajax 工具包中,您可以使用 Tab Container 并将 TabPanels 添加到其中。

我有一些控件希望能够在所有选项卡中使用,并根据需要使用其他控件来定制选项卡。

我的问题是如何在多个选项卡上重复使用一个面板? 基本上我追求这样的事情

<TabContainer>
<tabPanel1>
<contentTemplate>
<pnl1></pnl1>
//other controls here 
</contentTemplate>
</tabPanel1>

<tabPanel2>
<contentTemplate>
<pnl1></pnl1>
//other controls here
</contentTemplate>
<tabPanel2>
</tabContainer>


<pnl1>
//some controls here
</pnl1>

【问题讨论】:

    标签: asp.net vb.net


    【解决方案1】:

    使面板成为用户控件,然后将用户控件拖放到每个选项卡面板中。

    <TabContainer>
      <tabPanel1>
        <contentTemplate>
          <uc1:MyControl id="myControl" runat="server" />
        </contentTemplate>
      </tablPanel1>
    
      <tabPanel2>
        <contentTemplate>
          <uc1:MyControl id="myControl2" runat="server" />
        </contentTemplate>
      </tablPanel2>
    </TabContainer>
    
    <uc1:MyControl id="myControl3" runat="server" />
    

    【讨论】:

      【解决方案2】:

      没有办法重复使用同一个面板。我想您可以在每次单击选项卡时使用 JavaScript 将面板附加到新父级,但这似乎比它的价值更麻烦。

      考虑将面板移到选项卡之外,使其始终可见。选项卡用于更改内容,它可能会违反 UI 约定来执行您正在尝试的操作。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-07-14
        • 1970-01-01
        • 2011-04-21
        • 2015-10-20
        • 2014-09-28
        • 2011-04-20
        相关资源
        最近更新 更多