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

以下代码为新增一行,第一列为标题,第二列为图片:

 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

你可能感兴趣的:(System)