Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add a line break or html inside of a Panel?

I am trying to create a menu with the following code. But I cannot figure out how to get each LinkButton to appear on seperate lines.

MenuPanel.Controls.Clear();
foreach (FormList f in forms)
{
  if (f.IsActive == "y")
  {
     FormUserControl fc = (FormUserControl)LoadControl(f.StartControl);
     LinkButton lb = new LinkButton();
     lb.Text = fc.Title;
     MenuPanel.Controls.Add(lb);
     // I want some sort of line break here
  }
}
like image 215
ProgrammingPope Avatar asked Jan 22 '10 15:01

ProgrammingPope


1 Answers

FYI : If you have already added the panel control in the aspx(design-view) and if you want to use the above accepted answer in .cs file (code-behind)., then you will be running into type errors. So in that case, you could use this way. Please note the small cased "new".

Panel1.Controls.Add(new LiteralControl("<br>"));
like image 74
Shankar Narayana Damodaran Avatar answered Oct 16 '22 16:10

Shankar Narayana Damodaran