我正在从代码隐藏文件创建一个表。
MyControl control1 = (MyControl)Page.LoadControl("MyControl.ascx");
control1.ID = "ctl1";
MyControl control2 = (MyControl)Page.LoadControl("MyControl.ascx");
control2.ID = "ctl2";
MyControl control3 = (MyControl)Page.LoadControl("MyControl.ascx");
control3.ID = "ctl3";
MyControl control4 = (MyControl)Page.LoadControl("MyControl.ascx");
control4.ID = "ctl4";
Table table = new Table();
TableCell cell1 = new TableCell();
TableCell cell2 = new TableCell();
TableCell cell3 = new TableCell();
TableCell cell4 = new TableCell();
TableRow row1 = new TableRow();
cell1.Controls.Add(control1);
row1.Cells.Add(cell1);
cell2.Controls.Add(control2);
row1.Cells.Add(cell2);
cell3.Controls.Add(control3);
row1.Cells.Add(cell3);
cell4.Controls.Add(control4);
row1.Cells.Add(cell4);
table.Rows.Add(row1);
placeHolder1.Controls.Add(table);但我只看到第一个控件被加载,其他控件没有。丢了什么东西吗?
发布于 2012-09-14 18:03:08
你的控制就在那里。
您的CSS位置固定会导致它们重叠。
我创建了一个正在发生的jsfiddle to demonstrate。
您只能看到最后一个单元格中的仪表。
可以通过删除position: fixed修复此问题
请看这个jsfiddle solution。
https://stackoverflow.com/questions/12421846
复制相似问题