Adding <br/> dynamically between controls asp.net

49,535

Solution 1

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

Solution 2

I would suggest that you don't use
at all. Use CSS to display your controls. display:block on your elements will work just fine. Less messy!

Share:
49,535
softwaremonster
Author by

softwaremonster

Updated on October 04, 2020

Comments

  • softwaremonster
    softwaremonster over 3 years

    I'm listing some controls at my web page dynamically, either I'm adding newline with Label's.

    Label newLine = new Label();newLine.Text = "<br/>"; myPanel.Controls.Add(newLine);
    

    How can I do it in a different way?

  • softwaremonster
    softwaremonster about 14 years
    because i'm newbie here i have to wait for a special time to mark an answer as correct.
  • softwaremonster
    softwaremonster about 14 years
    I'm using Css either but I did not know that I could do that with Css. Could you write how? Which css code should I use?