Oct 29, 2013, 10:57 AM
[CLOSED] Problem to add panel to tabpanel from code behind
Hello
Please see code below:
But on example 2 the activation of Tab2 did not show the panel.
If I remove the DrawComponent, it works, so whats wrong as same code works weel into the window of example 1?
Please see code below:
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void showWindow1(object sender, EventArgs e)
{
//Declarations
Ext.Net.Window myWindow = (Ext.Net.Window)MyDesktop.Modules["Test1"].Window[0];
Ext.Net.Panel myZonePanel= new Ext.Net.Panel{
Title="Test",
Width=100,
Height=100,
X=10,
Y=10};
myZonePanel.Render(myWindow);
}
protected void Tab1Activate(object sender, EventArgs e)
{
//Declarations
Ext.Net.Panel PanelTab1 = (Ext.Net.Panel)Ext.Net.X.GetCmp("tab1");
Ext.Net.Panel myZonePanel = new Ext.Net.Panel
{
Title = "Test1",
Width = 100,
Height = 100,
X = 10,
Y = 10
};
myZonePanel.Render(PanelTab1);
}
protected void Tab2Activate(object sender, EventArgs e)
{
//Declarations
Ext.Net.Panel PanelTab2 = (Ext.Net.Panel)Ext.Net.X.GetCmp("tab2");
Ext.Net.Panel myZonePanel2 = new Ext.Net.Panel
{
Title = "Test2",
Width = 100,
Height = 100,
X = 20,
Y = 20
};
myZonePanel2.Render(PanelTab2);
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Desktop
ID="MyDesktop"
runat="server">
<DesktopConfig ID="DesktopConfig1" runat="server" Icons="start-button">
</DesktopConfig>
<Modules>
<ext:DesktopModule ModuleID="Test1" AutoRun="false">
<Window>
<ext:Window
ID="Window1"
runat="server"
Width="400"
Height="400"
ExpandOnShow="True"
TitleCollapse="false"
Collapsible="false"
Layout="AbsoluteLayout"
Maximizable="false"
Minimizable="False"
Closable="true"
Resizable="false"
Title="Tes1"
TitleAlign="Center">
<Items>
<ext:DrawComponent
ID="DrawComponent1"
runat="server"
ViewBox="false"
Height="10000"
Width="10000"
StyleSpec="background:white;">
</ext:DrawComponent>
</Items>
<DirectEvents>
<Show OnEvent="showWindow1"></Show>
</DirectEvents>
</ext:Window>
</Window>
</ext:DesktopModule>
<ext:DesktopModule ModuleID="Test2" AutoRun="false">
<Window>
<ext:Window
ID="Window2"
runat="server"
Width="400"
Height="400"
ExpandOnShow="True"
TitleCollapse="false"
Collapsible="false"
Layout="AbsoluteLayout"
Maximizable="false"
Minimizable="False"
Closable="true"
Resizable="false"
Title="Test2"
TitleAlign="Center">
<Items>
<ext:TabPanel runat="server" Border="false">
<Items>
<ext:panel runat="server" ID="tab1" Title="Tab1" >
<DirectEvents>
<Activate OnEvent="Tab1Activate"></Activate>
</DirectEvents>
</ext:panel>
<ext:panel runat="server" id="tab2" Title="Tab2">
<Items>
<ext:DrawComponent
ID="drwVMProcess"
runat="server"
ViewBox="false"
Height="10000"
Width="10000"
StyleSpec="background:white;">
</ext:DrawComponent>
</Items>
<DirectEvents>
<Activate OnEvent="Tab2Activate"></Activate>
</DirectEvents>
</ext:panel>
</Items>
</ext:TabPanel>
</Items>
</ext:Window>
</Window>
</ext:DesktopModule>
</Modules>
<StartMenu ID="mnuStartMenu" Height="350" Title="Start Here" runat="server" HideTools="True">
<MenuItems>
<ext:MenuItem Text="Example 1" Icon="Cog">
<Listeners>
<Click Handler="#{MyDesktop}.getModule('Test1').createWindow();" />
</Listeners>
</ext:MenuItem>
<ext:MenuItem Text="Example 2" Icon="Cog">
<Listeners>
<Click Handler="#{MyDesktop}.getModule('Test2').createWindow();" />
</Listeners>
</ext:MenuItem>
</MenuItems>
</StartMenu>
</ext:Desktop>
</form>
</body>
</html>
Example 1 works wellBut on example 2 the activation of Tab2 did not show the panel.
If I remove the DrawComponent, it works, so whats wrong as same code works weel into the window of example 1?
Last edited by Daniil; Oct 29, 2013 at 4:13 PM.
Reason: [CLOSED]