The following is the markup code:
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:ViewPort ID="ViewPort1" runat="server">
<Items>
<ext:BorderLayout ID="BorderLayout1" runat="server">
<North>
<ext:Panel ID="Panel1" runat="server" Title="North" Header="False" Height="29">
</ext:Panel>
</North>
<West Collapsible="true" Split="true" MaxWidth="200px">
<ext:TreePanel ID="tpnNavigator" runat="server" AutoHeight="True"
RootVisible="False" Width="200px" Icon="ApplicationViewList">
<DirectEvents>
<Click OnEvent="tpnNavigator_Click">
<ExtraParams>
<ext:Parameter Name="FunID" Value="node.id" Mode="Raw" />
</ExtraParams>
</Click>
</DirectEvents>
</ext:TreePanel>
</West>
<Center>
<ext:TabPanel ID="tpList" runat="server" Height="300" EnableTabScroll="True"
Draggable="true">
<Items>
<ext:Panel ID="pnlHome" runat="server" Draggable="true"
AutoWidth="true" Border="false" Icon="House"
BodyStyle="padding:10px 0px 10px 10px" ButtonAlign="Center">
</ext:Panel>
</Items>
</ext:TabPanel>
</Center>
</ext:BorderLayout>
</Items>
</ext:ViewPort>
The Following is the code-behind:
protected void tpnNavigator_Click(object sender, DirectEventArgs e)
{
string strFunID = e.ExtraParams["FunID"].ToString();
string strTabID = "TAB_" + strFunID;
bool Existed = false;
foreach (Ext.Net.Component li in tpList.Items)
{
if (li.ID == strTabID)
{
Existed = true;
break;
}
}
if (Existed)
{
tpList.SetActiveTab(strTabID);
}
else
{
SysFunctions objFun = SysFunctions.SelectByFunID(strFunID);
Ext.Net.Panel pnl = new Ext.Net.Panel();
pnl.ID = strTabID;
pnl.Title = objFun.FunName;
pnl.Closable = true;
pnl.AutoLoad.Url = objFun.FunURL;
pnl.AutoLoad.Mode = LoadMode.IFrame;
pnl.AutoLoad.ShowMask = true;
pnl.AutoLoad.MaskMsg = objFun.FunURL + "......";
//tpList.Items.Add(pnl);
pnl.Render(tpList, RenderMode.AddTo);
//pnl.AddTo(tpList);
tpList.SetActiveTab(strTabID);
}
}
After I clicked the treenode to add several tab in the TabPanel, the tpList.Items only contain
'pnlHome', the newly added tab were not included. If I click the clicked treenode, the tab
opened will be loaded again.</PRE>