【发布时间】:2018-08-09 02:33:13
【问题描述】:
我需要在运行时在我的 aspx 表格中添加按钮
table.Append("<table border='1' class='table table-striped' width='450px'>");
table.Append("<tr><th>Facilities</th><th>Size</th><th>InterestRate</th><th>View in Doc</th>");
table.Append("</tr>");
if (dr.HasRows)
{
while (dr.Read())
{
table.Append("<tr >");
table.Append("<td>" + dr[0] + "</td>");
table.Append("<td>" + dr[1] + "</td>");
table.Append("<td>" + dr[2] + "</td>");
table.Append("<td>" + <asp:Button ID = 'btnOpenDoc' runat = 'server' CssClass = 'button rounded' Width = '200px' Text = 'Open Document' OnClick = 'RunPowerShellScript_OnClick()'/> + "</td>");
table.Append("</tr>");
}
}
我对这条线有疑问:
table.Append("<td>" + <asp:Button ID = 'btnOpenDoc' runat = 'server' CssClass = 'button rounded' Width = '200px' Text = 'Open Document' OnClick = 'RunPowerShellScript_OnClick()'/> + "</td>");
【问题讨论】:
-
table变量的类型是什么?另请注意,您也在创建重复的 ID,这是一个 VeryBadThing。
标签: asp.net html-table