Apr 05, 2011, 4:59 PM
[CLOSED] Control Rendering issue
Hi,
I am trying to create controls at runtime inside each panel in tab panel control. If I call those control creation methods at page load the controls are showing. Instead of that if I call from button direct events the controls are not showing.
I am trying to create controls at runtime inside each panel in tab panel control. If I call those control creation methods at page load the controls are showing. Instead of that if I call from button direct events the controls are not showing.
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.tabSections.HideTabStripItem(pnlSection2);
this.tabSections.HideTabStripItem(pnlSection3);
//PopulateSection2Controls();
//PopulateSection3Controls();
}
}
public void ShowSectionSelected(Object sender, DirectEventArgs e)
{
Ext.Net.Button btn;
btn = (Ext.Net.Button)sender;
if (btn.ID == "btn2")
{
this.tabSections.UnhideTabStripItem(pnlSection2);
PopulateSection2Controls();
}
else
{
PopulateSection3Controls();
this.tabSections.UnhideTabStripItem(pnlSection3);
}
}
public void PopulateSection2Controls()
{
Ext.Net.Container c = new Ext.Net.Container();
Ext.Net.Label lblLabel = new Ext.Net.Label();
Ext.Net.TextField txtFld = new Ext.Net.TextField();
lblLabel.ID = "lblfiled1";
lblLabel.Text = "Field Label1";
txtFld.ID = "txtField1";
txtFld.EmptyText = "Enter Field value";
c.Items.Add(lblLabel);
c.Items.Add(txtFld);
pnl1center.Items.Add(c);
this.tabSections.SetActiveTab(pnlSection2);
}
public void PopulateSection3Controls()
{
Ext.Net.Container c = new Ext.Net.Container();
Ext.Net.Label lblLabel = new Ext.Net.Label();
Ext.Net.TextField txtFld = new Ext.Net.TextField();
lblLabel.ID = "lblfiled2";
lblLabel.Text = "Field Label2";
txtFld.ID = "txtField2";
txtFld.EmptyText = "Enter Field value";
c.Items.Add(lblLabel);
c.Items.Add(txtFld);
pnl2center.Items.Add(c);
this.tabSections.SetActiveTab(pnlSection3);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager" runat="server" />
<ext:Viewport ID="vpReqFields" runat="server" Layout="border">
<Items>
<ext:TabPanel ID="tabSections" runat="server" ActiveTabIndex="0" Title="TabPanel"
Region="Center">
<Items>
<ext:Panel ID="pnlSection1" runat="server" Title="Section 1" Layout="Fit" BodyStyle="background-color:#d9d9d9">
</ext:Panel>
<ext:Panel ID="pnlSection2" runat="server" Title="Section 2" Layout="Border" BodyStyle="background-color:#d9d9d9">
<Items>
<ext:Panel ID="pnl1center" runat="server" Region="Center"></ext:Panel>
</Items>
</ext:Panel>
<ext:Panel ID="pnlSection3" runat="server" Title="Section 3" Layout="Border" BodyStyle="background-color:#d9d9d9">
<Items>
<ext:Panel ID="pnl2center" runat="server" Region="Center"></ext:Panel>
</Items>
</ext:Panel>
</Items>
</ext:TabPanel>
<ext:Panel ID="pnlButtons" runat="server" Region="South" Height="40" ButtonAlign="Center">
<Items>
</Items>
<Buttons>
<ext:Button ID="btn2" runat="server" Text="Show Section 2">
<DirectEvents>
<Click OnEvent="ShowSectionSelected">
<EventMask ShowMask="true" Msg="Loading..." />
</Click>
</DirectEvents>
</ext:Button>
<ext:Button ID="btn3" runat="server" Text="Show Section 3">
<DirectEvents>
<Click OnEvent="ShowSectionSelected">
<EventMask ShowMask="true" Msg="Loading..." />
</Click>
</DirectEvents>
</ext:Button>
</Buttons>
</ext:Panel>
</Items>
</ext:Viewport>
</form>
</body>
</html>
Last edited by Daniil; Apr 09, 2011 at 12:57 PM.
Reason: [CLOSED]