Dynamic viewport's center area

  1. #1

    Dynamic viewport's center area

    Hi i want to create viewport dynamically to my placeholder called PlaceHolder1 and add center area's controls dynamically, i added placeholder to center area and add textbox to this placeholder but textbox do not display properly, how can i solve this problem?



    ViewPort container = new ViewPort();


    BorderLayout layout = new BorderLayout();


    container.BodyControls.Add(layout);


    Panel westPanel = new Panel();


    westPanel.Width = new System.Web.UI.WebControls.Unit(100);


    westPanel.Title = "west";


    westPanel.Html = "west";


    layout.West.Items.Add(westPanel);


    Panel centerPanel = new Panel();


    centerPanel.Html = "center";


    layout.Center.Items.Add(centerPanel);


    System.Web.UI.WebControls.PlaceHolder dynamicPlaceHolder = new System.Web.UI.WebControls.PlaceHolder();


    centerPanel.BodyControls.Add(dynamicPlaceHolder);


    System.Web.UI.WebControls.TextBox t1 = new System.Web.UI.WebControls.TextBox();


    dynamicPlaceHolder.Controls.Add(t1);


    Panel eastPanel = new Panel();


    eastPanel.Width = new System.Web.UI.WebControls.Unit(100);


    eastPanel.Title = "East";


    eastPanel.Html = "east";


    layout.East.Items.Add(eastPanel);


    layout.East.Split = true;


    layout.East.Collapsible = true;


    layout.West.Split = true;


    layout.West.Collapsible = true;


    PlaceHolder1.Controls.Add(container);
  2. #2

    RE: Dynamic viewport's center area

    Hi testix,

    If you comment out the centerPanel.Html = "center"; code then the layout will work correctly. To add both "text" and Controls to the BodyContainer, please add the Text as a <ext:Label> or LiteralControl.


    If the .Html is set, it will replace all the contents of the Body with the .Html value. If controls have been added to the BodyContainer, then they may (or may not) render properly. 


    Hope this helps.


    Geoffrey McGill
    Founder & CEO

Similar Threads

  1. Replies: 5
    Last Post: Jun 18, 2012, 8:47 PM
  2. Replies: 2
    Last Post: Jun 18, 2012, 6:43 PM
  3. Replies: 5
    Last Post: Mar 22, 2012, 2:12 PM
  4. [CLOSED] Center tablelayout in viewport
    By CarWise in forum 1.x Premium Help
    Replies: 5
    Last Post: Apr 01, 2011, 12:04 PM
  5. Replies: 6
    Last Post: Sep 25, 2009, 3:51 AM

Posting Permissions