我在代码隐藏文件中添加表。我想在其中添加标签。
<table id="tbl" runat="server">
<tr>
<th>test</th>
<td>
</td>
</tr>
</table>我不知道如何通过代码添加。
那么谁能告诉我怎么添加标签呢?
发布于 2012-04-18 19:41:36
HtmlTable t = tbl; //just to make it clear your table is an HtmlTable
tbl.Rows[0].Cells.Add(new HtmlTableCell("th")); //adds an emtpy cell to the first row with th tagname发布于 2012-04-18 19:47:19
Table t = new Table();
TableHeaderRow th = new TableHeaderRow();
th.Controls.Add(new LiteralControl("test"));
t.Controls.Add(th);
containerControlForTheTable.Controls.Add(t);发布于 2018-10-15 16:41:52
Dim tr As New HtmlTableRow
tr.Cells.Add(New HtmlTableCell("th"))
yourtable.Rows.Add(tr)https://stackoverflow.com/questions/10208548
复制相似问题