Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/324.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 添加新控件后添加新行_C#_Asp.net - Fatal编程技术网

C# 添加新控件后添加新行

C# 添加新控件后添加新行,c#,asp.net,C#,Asp.net,在添加每个控件后,如何添加新行?我要添加到的控件是一个表单元格 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 =

在添加每个控件后,如何添加新行?我要添加到的控件是一个表单元格

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);                
}
for(int i=0;i<60;i++)
{
复选框cb=新复选框();
cb.ID=“MitchelF”+i.ToString();
标签lbl=新标签();
lbl.Text=“MitchelF”;
lbl.Font.Size=新字体单位(“18px”);
lbl.ID=“MitchelF”+i.ToString();
cellUsersPool.Controls.Add(cb);
cellUsersPool.Controls.Add(lbl);
}

您可以通过类将换行符作为HTML文本插入:

//添加元素
cellUsersPool.Controls.Add(cb);
cellUsersPool.Controls.Add(lbl);
//显式插入换行符
cellUsersPool.Controls.Add(新的LiteralControl(“
”);
// Add your elements
cellUsersPool.Controls.Add(cb);
cellUsersPool.Controls.Add(lbl);
// Explicitly insert a line break
cellUsersPool.Controls.Add(new LiteralControl("<br />"));