2.内容:
a) 使用HtmlGenericControl创建HTML标签
引入命名空间: using System.Web.UI.HtmlControls;
更改其属性: hgg_div.Attributes.Add("style","width:200px; height:200px;");
内容设置: hgg_div.InnerText = "我是一个" + htmlTag;(htmlTag可以是div,br,span…)
或者InnerHtml来给div写一些html
b) 使用Table newTable = new Table();创建表格控件
newTable.Width = 200;设置高
newTable.Height = 200; 设置宽
创建行: TableRow newTableRow = new TableRow();
newTableRow.Height = 20;
创建单元格: TableCell newTableCell = new TableCell();
newTableCell.Width = 100;
newTableCell.Text = "我是一个单元格";
添加到表格中: newTableRow.Controls.Add(newTableCell);
newTableRow.Controls.Add(newTableCell);
newTable.Controls.Add(newTableRow);
Page.Controls.Add(newTable);//添加到表单外(control)
Page.Form.InnerHtml=str;//添加到表单内(html)