添加每个控件后,如何添加新行?我添加的控件是表格单元格。
for (int i = 0; i < 60; i++)
{
CheckBox cb = new CheckBox();
cb.ID = "MitchelF" + i.ToString();
Label lbl = new Label();
lbl.Text = "MitchelF";
lbl.Font.Size = new FontUnit("18px");
lbl.ID = "MitchelF" + i.ToString();
cellUsersPool.Controls.Add(cb);
cellUsersPool.Controls.Add(lbl);
}
答案 0 :(得分:0)
您可以通过LiteralControl
类插入换行符作为HTML文字:
// Add your elements
cellUsersPool.Controls.Add(cb);
cellUsersPool.Controls.Add(lbl);
// Explicitly insert a line break
cellUsersPool.Controls.Add(new LiteralControl("<br />"));