[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Export Gridview to Excel

Posted on 2011-10-19
4
Medium Priority
?
252 Views
Last Modified: 2012-05-12
I am trying to export Gridview1 to Excel. I keep getting this error. Please see attachment.
ee.bmp
0
Comment
Question by:VBdotnet2005
4 Comments
 
LVL 17

Accepted Solution

by:
Carlos Villegas earned 2000 total points
ID: 36996970
Hello, maybe this can help you, at the top of your aspx file, set the EnableEventValidation="false", example:
<%@ Page Language="vb" EnableEventValidation="false" %>
0
 
LVL 12

Expert Comment

by:Ramkisan Jagtap
ID: 36997784
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
 
LVL 14

Expert Comment

by:Dustin Hopkins
ID: 37004725
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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question