int numOfPages = 10; protected void Page_Load(object sender, EventArgs e) { if (numOfPages > 1 && (string)Session["REVIEW"] != null && (string)Session["REVIEW"] == "REVIEW") { createButton(numOfPages); } } public void createButton(int numOfPages) { TableRow tblPageRow = new TableRow(); for (int i = 1; i <= numOfPages; i++) { TableCell tblPageCell = new TableCell(); System.Web.UI.WebControls.Button btnDisPage = new System.Web.UI.WebControls.Button(); //btnDisPage.Attributes.Add("onclik", "showRows(" + (i) + "," + disRows + "," + rowCount); btnDisPage.ID = "btnDis" + i; btnDisPage.Click += new EventHandler(btnDisPage_Click); btnDisPage.Text = "第" + (i) + "页"; tblPageCell.Controls.Add(btnDisPage); tblPageRow.Controls.Add(tblPageCell); } tblPageControl.Controls.Add(tblPageRow); } public void btnDisPage_Click(object sender, EventArgs e) { Response.Write("asdfsd"); } 控件能生成,但当我点击button以,显页好象重新加载。页面上的button都没了。 为什么?