[CLOSED] Control Rendering issue

  1. #1

    [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.

    
    <%@ 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]
  2. #2
    Hi,

    You'll need to call .Render() on the pnl2center component, or use .AddTo on 'c'.

    Example

    c.AddTo(pnl2center);
    Geoffrey McGill
    Founder

Similar Threads

  1. [CLOSED] Rendering Issue in MVC
    By webppl in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 21, 2012, 10:13 PM
  2. [CLOSED] IE 6 Rendering Issue
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 13
    Last Post: Jun 14, 2011, 12:08 PM
  3. [CLOSED] Rendering issue after upate
    By Labyrinth in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 13, 2010, 5:07 AM
  4. Rendering issue with HeaderRows
    By asztern in forum 1.x Help
    Replies: 0
    Last Post: Jan 30, 2010, 10:33 AM
  5. [CLOSED] [0.8.2] IE7 Rendering Issue
    By rcaunt in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Jan 27, 2010, 6:42 AM

Tags for this Thread

Posting Permissions