views:

490

answers:

2

In the Ajax toolkit you can use a Tab Container and add TabPanels to this.

I have some controls that I want to be able to use across all tabs and the tailor the tabs with other controls as neccessary.

My question is how do I reuse a panel on multiple tabs? Essentially I after something like this

<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>
+1  A: 

Make the panel a user control and then drop the user control in each tab panel.

<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" />
A: 

There isn't a way to reuse the same panel. I guess you could use JavaScript to attach the panel to a new parent every time a tab is clicked, but that seems like more trouble than its worth.

Consider moving the panel outside the tabs so it's always be visible. Tabs are for changing content, and it may go against UI conventions to do what you're attempting.

Dan Goldstein