asp.net - DataExport to Excel Error -
Hello, I am trying to export the Sheet from Excel to Excel, but this is an error.
RegisterForEventValidation is only called during the render ();
Here is my code
slow attachment string attachment = "attachment; file name = contacts.xls" Response.ClearContent () in response form. AddHeader ("Content-Properties", Attachment) Response.ContentType = "application / ms-excel" New HtmlTextWriter (myStringWriter) GridView1.RenderControl (myhtmlStringWriter) as MyStringWriter as New my.StringWriter Response.Write (myStringWriter ToString) response.
In the .config file, eventValidation will be closed for all pages in this situation.
Or you can do this in a page instruction that turns off validation for a single page.