关于将Asp.Net页面输出到EXCEL里去的问题
protected void Button3_Click(object sender, EventArgs e){
Response.Clear();
Response.Buffer= true;
Response.Charset="utf-8";
Response.AppendHeader("Content-Disposition", "attachment;filename=FileFlow.xls");
Response.ContentEncoding = System.Text.Encoding.Default;
Response.ContentType = "application/ms-excel";
this.EnableViewState = false;
oStringWriter = new ();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
}
调试显示RegisterForEventValidation can only be called during Render();的错误!
不知道为什么!请高手指教。