现在的位置: 首页 > 综合 > 正文

System.Web.UI.WebControls.Table的使用

2012年06月08日 ⁄ 综合 ⁄ 共 696字 ⁄ 字号 评论关闭
以下代码为新增一行,第一列为标题,第二列为图片:

 1            TableRow tr1 = new TableRow();
 2            TableCell c1 = new TableCell();
 3            c1.Width = 100;
 4            c1.CssClass = "1";
 5            c1.Text = "";
 6            c1.ID = "c11";
 7            tr1.Controls.Add(c1);
 8
 9            TableCell c2 = new TableCell();
10            c2.ID = "c12";
11            c2.CssClass = "2";
12            System.Web.UI.WebControls.Image image1 = new System.Web.UI.WebControls.Image();
13            image1.Width = 400;
14            image1.Height = 300;
15            image1.ImageUrl = "../" + picPath;
16            c2.Controls.Add(image1);
17            tr1.Controls.Add(c2);
18
19            this.Table1.Rows.Add(tr1);
20
【上篇】
【下篇】

抱歉!评论已关闭.