ASP.NET中动态生成表格时遇到的问题
<script Language="C#" runat="server">
代码如下(调试出现错误):
void Page_Load(object sender, EventArgs e)
{
int rows=int.Parse(txtRow.Text);
int cells=int.Parse(txtCell.Text);
for(int i=0;i<rows;i++)
{
TableRow r=new TableRow();
for(int j=0;j<cells;j++)
{
TableRow c=new TableRow();
c.Controls.Add(new LiteralControl("("+i.ToString()+","+j.ToString()+")"));
r.Cells.Add(c);
}
Table1.Rows.Add(r);
}
}
</script>