I was looking for a way to export a gridview of an asp.net site to an Excel-file (.xls). Most methods I found involved overriding a Page-method and/or disabling validation of the controls. The solution provided by Matt Berseth is safer and more elegant in that it uses a seperate class with a shared method (static for C# people). This way, you can access it from multiple pages without having to rewrite the code multiple times.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.