Jul 05, 2014, 7:28 PM
[CLOSED] TabPanel DirectEvent TabChange and Page_Load
When I add the TabChange DirectEvent to a TabPanel, it causes the Page_Load to fire on each TabChange (I would assume it would).
I am trying to use the Page_Load to dynamically add controls to the clicked tab. 2 Questions:
1) How do I know which tab was clicked (seems like ActiveTabIndex should have this value) ?
2) Only the dynamic controls on the first tab are actually rendered, I can never get controls on the other tabs to render?
Here is a simple example:
I am trying to use the Page_Load to dynamically add controls to the clicked tab. 2 Questions:
1) How do I know which tab was clicked (seems like ActiveTabIndex should have this value) ?
2) Only the dynamic controls on the first tab are actually rendered, I can never get controls on the other tabs to render?
Here is a simple example:
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
switch (tpMain.ActiveTabIndex)
{
case 0:
tb1.Controls.Add(new Ext.Net.Label("Hello Tab 1"));
break;
case 1:
tb2.Controls.Add(new Ext.Net.Label("Hello Tab 2"));
break;
}
}
protected void tpMain_Change(object sender, Ext.Net.DirectEventArgs e)
{
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>TabPanel Example</title>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:TabPanel ID="tpMain" runat="server">
<Items>
<ext:Panel
ID="tb1"
runat="server"
Title="Tab1">
</ext:Panel>
<ext:Panel
ID="tb2"
runat="server"
Title="Tab2">
</ext:Panel>
</Items>
<DirectEvents>
<TabChange OnEvent="tpMain_Change"></TabChange>
</DirectEvents>
</ext:TabPanel>
</body>
</html>
Thank you for your help, Craig
Last edited by Daniil; Jul 11, 2014 at 5:07 PM.
Reason: [CLOSED]