Apr 03, 2009, 4:58 AM
Add tab to my center tabpanel on tree node click. The new tab should come from server and having webcontrols with it. Not rendering in DOM
I am not able to add a new tab into tabpanel from my server side code. The control is hitting my getFK method and crearting a new tab and also adding it into the center panel i.e. pnlCenter. But the newly added tab is not displayed and I am not getting the newly added tab in the DOM.
Please suggest, how to add a new tab dynamically on tree node click. The new tab should come from server.
<ext:TreePanel ID="pnlTree"
Width="175"
runat="server"
Border="false"
RootVisible="false"
EnableDD="false"
AutoScroll="true"
Collapsible = "true">
<Loader>
<ext:TreeLoader DataUrl="Handlers/getTreeNodes.ashx" />
</Loader>
<Root>
<ext:AsyncTreeNode NodeID="TreeRoot" Text="Root"/>
</Root>
<AjaxEvents>
<Click OnEvent="getFK" />
</AjaxEvents>
The getFK method should add a new tab to my center tabpanel.
Here is code of my getFK which lies on server.
public void getFK()
{
try{
Tab newFK1 = new Tab();
newFK1.ID = "newFK1" + DateTime.Now.Second;
newFK1.Listeners.Activate.Fn = "ActivateTab";
newFK1.Closable = true;
newFK1.Title = "My Function Key" + DateTime.Now.Second;
newFK1.Listeners.BeforeClose.Fn = "fkBeforeClose";
////Creating object of my web control.
FKWindow fkTab1 = (FKWindow)LoadControl("FKwindow.ascx");
fkTab1.IsCopyColVisible = true;
fkTab1.IsZeroSAreaVisible = true;
fkTab1.LabelForColumn = "Adressen2" + DateTime.Now.Second;
fkTab1.LabelForCopyColumn = "Kopier Nach2" + DateTime.Now.Second;
fkTab1.FKWindowId = "newFK1" + DateTime.Now.Second;
////Adding a new tab to my web control
Tab newTab1 = new Tab();
newTab1.Html = "My tab1" + DateTime.Now.Second;
newTab1.Title = "Tab1" + DateTime.Now.Second;
fkTab1.AddTab(newTab1, 0);
newFK1.DoLayout(true);
////Adding the newly added tab to my center panel
if (!pnlCenter.Tabs.Contains(newFK1))
pnlCenter.Tabs.Add(newFK1);
pnlCenter.DoLayout(true);
pnlCenter.SetActiveTab(newFK1);
}
catch (Exception Ex)
{throw new Exception(Ex.Message);}
}