runat="server"的table动态添加行的问题
有一个这样的Table。我想在按下一个Button。这个Table就自动添加一行。代码如下。但是当添加成功一行后。第二次按button的时候,这个Table的行数没有增加。调试过后发现是table1在每次按下Button后都被还原成了。请问有谁知道怎么解决这个问题?
<table runat="server" id="table1">
<tr>
<td>字段名</td>
<td>值</td>
</tr>
<!--动态添加的内容 -->
</table>
protected void Btn_Add_Click(object sender, EventArgs e)
{
HtmlTableRow NewRow = new HtmlTableRow();
HtmlTableCell NewCellField = new HtmlTableCell();
HtmlTableCell NewCellValue = new HtmlTableCell();
TextBox NewFieldTextBox = new TextBox();
TextBox NewValueTextBox = new TextBox();
NewFieldTextBox.Text = "新字段";
NewValueTextBox.Text = "新值";
//添加文本框
NewCellField.Controls.Add(NewFieldTextBox);
NewCellValue.Controls.Add(NewValueTextBox);
//添加TD
NewRow.Cells.Add(NewCellField);
NewRow.Cells.Add(NewCellValue);
//添加TR
table1.Rows.Add(NewRow);
}