Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.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
Asp.net 视觉工作室ASPX。使用面板在列中动态创建控件_Asp.net_Visual Studio - Fatal编程技术网

Asp.net 视觉工作室ASPX。使用面板在列中动态创建控件

Asp.net 视觉工作室ASPX。使用面板在列中动态创建控件,asp.net,visual-studio,Asp.net,Visual Studio,我有一个充满对象的列表,对于每个对象,我想在运行时创建一个新标签。我想把标签叠在一起,而不是并排 for (int i = 0; i < list_product.Count; i++) { int labelCount = 1; Label newLabel = new Label(); newLabel.ID = "newLabel" + labelCount; newLabel.Text = list_product[i].ProductName;

我有一个充满对象的列表,对于每个对象,我想在运行时创建一个新标签。我想把标签叠在一起,而不是并排

for (int i = 0; i < list_product.Count; i++)
{
    int labelCount = 1;
    Label newLabel = new Label();
    newLabel.ID = "newLabel" + labelCount;
    newLabel.Text = list_product[i].ProductName;
    labelCount++;
    panel_test.Controls.Add(newLabel);

}
for(int i=0;i

我到处找,找不到解决办法。谢谢你的帮助

你能修好代码缩进吗?对不起,我不明白你的意思。你想让我怎么把它修好?我对这个东西很陌生,这是用CSS在前端完成的。它与C代码以及标签的生成方式无关。