The FormPanel can not add items from code behind

  1. #1

    The FormPanel can not add items from code behind

    <%@ Page Language="C#"%>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                
            }
       }
    
        protected void BtnAddInfo_Click(object sender, EventArgs e)
        {
            fpAttribute.Disabled = false;
            fpAttribute.Items.Add(new Ext.Net.Button { ID = "Button2", Text = "Button2" });
            fpAttribute.DoLayout();
            EditWindow.Show();
        }
    
    </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 Example</title>
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            
            <ext:Button ID="BtnAddInfo" Text="Button1" runat="server">
                <DirectEvents>
                    <Click OnEvent="BtnAddInfo_Click" />
                </DirectEvents>
            </ext:Button>
    
            <ext:Window ID="EditWindow" Hidden="true" runat="server" Title="EditInfo" Width="650" Height="380" Modal="false" Collapsible="true" Maximizable="true" Layout="Fit" LabelWidth="70">
                <Items>
                    <ext:TabPanel ID="TabPanel1" runat="server" ActiveTabIndex="0" Border="false" DeferredRender="true">
                        <Items>
                            <ext:FormPanel ID="fpAttribute" runat="server" Title="Attribute" Disabled="true" Padding="10" Icon="PhoneStop">
                            </ext:FormPanel>
                        </Items>
                    </ext:TabPanel>
                </Items>
                <Buttons>
                    <ext:Button ID="CancelButton" runat="server" Text="Cancel" Icon="Cancel">
                        <Listeners>
                            <Click Handler="#{EditWindow}.hide();" />
                        </Listeners>
                    </ext:Button>
                </Buttons>
            </ext:Window>
        </form>
    </body>
    </html>
    Thanks in advance.
    Last edited by sk2276699; Jun 25, 2011 at 12:02 PM.
  2. #2
    hi,
    I feel helpless,can you help me?
    My English is poor,sorry!
  3. #3
    Hi,

    You have to render new control during ajax request
    protected void BtnAddInfo_Click(object sender, EventArgs e)
        {
            fpAttribute.Disabled = false;
            var b = new Ext.Net.Button { ID = "Button2", Text = "Button2" };
            fpAttribute.Items.Add(b);
            b.Render();
            EditWindow.Show();
        }
    Please see
    http://examples1.ext.net/#/XRender/Basic/Add_Items/
    http://examples1.ext.net/#/XRender/Basic/New_Window/
    Vladimir Shcheglov
    Sr. Developer
  4. #4
    Thanks a lot.
    Quote Originally Posted by Vladimir View Post
    Hi,

    You have to render new control during ajax request
    protected void BtnAddInfo_Click(object sender, EventArgs e)
        {
            fpAttribute.Disabled = false;
            var b = new Ext.Net.Button { ID = "Button2", Text = "Button2" };
            fpAttribute.Items.Add(b);
            b.Render();
            EditWindow.Show();
        }
    Please see
    http://examples1.ext.net/#/XRender/Basic/Add_Items/
    http://examples1.ext.net/#/XRender/Basic/New_Window/

Similar Threads

  1. [CLOSED] Add items to FormPanel during a DirectEvent
    By jmcantrell in forum 1.x Premium Help
    Replies: 2
    Last Post: Mar 27, 2012, 5:48 PM
  2. Replies: 13
    Last Post: Jun 22, 2011, 3:05 PM
  3. Changing FormPanel Items
    By wdk in forum 1.x Help
    Replies: 1
    Last Post: Apr 25, 2011, 7:27 AM
  4. Replies: 1
    Last Post: Dec 06, 2010, 9:51 AM
  5. Convert FormPanel from Html-Code to VB.Net Code
    By stephan1985 in forum 1.x Help
    Replies: 1
    Last Post: Jan 27, 2010, 4:47 PM

Posting Permissions