1
嗨我試圖從數據導出到Excel工作表的數據,但有這個錯誤。數據導出到Excel錯誤
RegisterForEventValidation只能在渲染()期間調用;
這裏是我的代碼
Dim attachment As String
attachment = "attachment; filename=Contacts.xls"
Response.ClearContent()
Response.AddHeader("content-disposition", attachment)
Response.ContentType = "application/ms-excel"
Dim myStringWriter As New IO.StringWriter
Dim myhtmlStringWriter As New HtmlTextWriter(myStringWriter)
GridView1.RenderControl(myhtmlStringWriter)
Response.Write(myStringWriter.ToString)
Response.End()
感謝
你打電話給這個事件? – cjk 2009-04-27 08:48:56