Exporting a asp.net gridview to Excel

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.