Control Layout of Panel programmatically

Discussion in 'ASP .Net Web Controls' started by Novice, Sep 24, 2004.

  1. Novice

    Novice Guest

    Hey all, last question on this subject - I hope.

    I'm programmatically adding a Panel to a webpage and also programmatically
    I'm adding controls to that Panel.

    How do I control the layout of those controls that I put into the Panel?

    Right now they are all just getting put onto the same line - when I was
    doing Java development I could set the layout for JPanels and then add
    components to them.

    Does the same principle apply for .Net Panels? If so, can you direct me to
    a tutorial on how to do this?

    Or show me via an example - how at least I can put a line separator in
    between two controls - example:
    Panel panel = new Panel();
    Label label1 = new Label();
    label1.Text = "some text";
    panel.Controls.Add(label1);
    //Need a line separator to be added to Panel here
    Label label2 = new Label();
    label2.Text = "some text";
    panel.Controls.Add(label2);

    Thanks,
    Novice
    Novice, Sep 24, 2004
    #1
    1. Advertising

  2. Novice

    Alex Homer Guest

    Try:

    panel.Controls.Add(new LiteralControl("<br />"));

    ?
    Alex Homer, Sep 28, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rick Spiewak
    Replies:
    3
    Views:
    3,152
    Rick Spiewak
    Aug 26, 2003
  2. Replies:
    1
    Views:
    572
    John Timney \(MVP\)
    Jun 19, 2006
  3. Ulf Meinhardt
    Replies:
    0
    Views:
    610
    Ulf Meinhardt
    Jul 7, 2009
  4. Robin Wenger
    Replies:
    0
    Views:
    2,928
    Robin Wenger
    Aug 18, 2011
  5. Chris

    Grid Layout Panel and Panel in the Designer

    Chris, Aug 28, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    201
    Chris
    Aug 28, 2003
Loading...

Share This Page