[CLOSED] Column Layouts from codebehind

  1. #1

    [CLOSED] Column Layouts from codebehind

    Hi,
    The question is how exacly make column layout from code behind?
    here is my code which not working as he should(nothing displayed after add this to Ext.Net.Panel)
    Ext.Net.ColumnLayout columnLayout = new ColumnLayout();
                    LayoutColumn col1 = new LayoutColumn();
                    LayoutColumn col2 = new LayoutColumn();
                    Ext.Net.Panel panelLeftContainer = new Ext.Net.Panel();
                    panelLeftContainer.ID = "leftContainerMMP";
                    Ext.Net.Panel panelRightContainer = new Ext.Net.Panel();
                    panelRightContainer.ID = "rightContainerMMP";
    
                    // adding some controls to panelsContainers
    
                    col1.ColumnWidth = 0.5M;
                    col2.ColumnWidth = 0.5M;
                    col1.Items.Add(panelLeftContainer);
                    col2.Items.Add(panelRightContainer);
                    columnLayout.Columns.Add(col1);
                    columnLayout.Columns.Add(col2);
                    Ext.Net.Viewport viewport = new Ext.Net.Viewport();
                    viewport.Width = 800;
                    viewport.Items.Add(columnLayout);
                    test_pan.Items.Add(viewport);
    Is there anything i need to add more to make it work?
    Last edited by geoffrey.mcgill; Apr 12, 2012 at 11:59 PM. Reason: [CLOSED]
  2. #2
    Hi,

    The following sample should help.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Import Namespace="Panel=Ext.Net.Panel" %>
    
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    
    <script type="text/C#" runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            var viewport = new Viewport
            {
                Layout = "column",
                Items = { 
                    new Panel { 
                        ColumnWidth = 0.5,
                        Title = "Panel 1"
                    },
                    new Panel {
                        ColumnWidth = 0.5,
                        Title = "Panel 2"
                    }
                }
            };
    
    
            this.Form.Controls.Add(viewport);
        }
    </script>
    
    
    <!DOCTYPE html>
    
    
    <html>
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
    <form runat="server">
        <ext:ResourceManager runat="server" />
    </form>
    </body>
    </html>
    Geoffrey McGill
    Founder
  3. #3
    Thanks that was really helpfull example :)
    but I need to make this viewport little smallest than all screen. How can i do that?
  4. #4
    Quote Originally Posted by ViDom View Post
    Thanks that was really helpfull example :)
    but I need to make this viewport little smallest than all screen. How can i do that?
    The Viewports role is to fill the entire page (ie, Viewport). If you need something smaller, than maybe a Panel or Container are better suited.

    Hope this helps.
    Geoffrey McGill
    Founder
  5. #5
    Yeah it's exremely helped:)
    Thanks again:)

Similar Threads

  1. Replies: 3
    Last Post: Sep 08, 2011, 1:22 AM
  2. Replies: 2
    Last Post: Mar 04, 2011, 11:54 AM
  3. [CLOSED] Hide Column in Codebehind
    By tms in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 06, 2010, 12:31 PM
  4. [CLOSED] Complex layouts in codebehind
    By jcanton in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 19, 2009, 10:07 AM
  5. [CLOSED] Bug w/Row & Column Layouts in Tabs
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 07, 2009, 12:53 AM

Tags for this Thread

Posting Permissions