Export Gridview to Excel

I am trying to export Gridview1 to Excel. I keep getting this error. Please see attachment.
ee.bmp
VBdotnet2005Asked:
Who is Participating?
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Hello, maybe this can help you, at the top of your aspx file, set the EnableEventValidation="false", example:
<%@ Page Language="vb" EnableEventValidation="false" %>
0
 
Ramkisan JagtapLead DeveloperCommented:
Hi,

 Just set viewstate false
 
//Turn off the view state
this.EnableViewState = False;
//Remove the charset from the Content-Type header
Response.Charset = String.Empty;
and
EnableEventValidation="false"
0
 
Dustin HopkinsSenior Web DeveloperCommented:
Why don't you try using the helper utility here:
http://mattberseth.com/blog/2007/04/export_gridview_to_excel_1.html

The above methods are fine, depending on the content that your page is displaying, disabling event validation can be a potential security risk.
This helper class should prevent the need to Override VerifyRenderingInServerForm or turn off event validation.

One modification you may want to make t the code provided is to disable paging as the code in its current form will only export the rows visible on the current page.

Hope this helps,
Dustin
0
 
VBdotnet2005Author Commented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.