工作vs05.when我出口的GridView到Excel比我得到下面的錯誤GridView中脫穎而出的asp.net
RegisterForEventValidation只能渲染期間被稱爲();
爲什麼我得到這個錯誤。如何解決它?
public void ToExcel()
{
string attachment = "attachment; filename=Employee.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/ms-excel";
StringWriter stw = new StringWriter();
HtmlTextWriter htextw = new HtmlTextWriter(stw);
gvSearch.RenderControl(htextw);
Response.Write(stw.ToString());
Response.End();
}
public override void VerifyRenderingInServerForm(Control control)
{
}
我仍然得到這個錯誤「RegisterForEventValidation只能在Render();」期間調用;「 – HelloBD 2009-11-04 03:28:03