1 回答
TA贡献1842条经验 获得超12个赞
您可以使用 ASP.NET 服务器端表格控件,然后动态添加行并为每一行添加所需的单元格,如下面的代码
ASPX
<asp:Table ID="myTable" runat="server" Width="100%">
</asp:Table>
ASPX.CS
foreach (DataRow row in tlds.Rows)
{
date = row["releaseDate"].ToString();
price = Convert.ToDouble(row["price"]);
tags = row["tags"].ToString();
TableRow row = new TableRow();
TableCell TLIdCell= new TableCell();
TLIdCell.Text = Convert.ToInt32(row["tldID"]);
row.Cells.Add(TLIdCell);
TableCell tldNameCell = new TableCell();
tldNameCell .Text = Convert.ToString(row["tldName"]);
row.Cells.Add(tldNameCell);
//Similarly add code for date, price and tags cells
// Finally add row to table rows collection
myTable.Rows.Add(row);
}
- 1 回答
- 0 关注
- 121 浏览
添加回答
举报