Tuesday, June 22, 2010

Export Grid To Excel

This is simple code to export gridview data in export to excel.
Here I assume that Data table name is “_sampleData” and it is already there. To execute the code I also assumed that button names “Button1” is also present and I have called one function named “GridExportToExcel” on click event of that button.

Following is the function to export Gridview control to excel function has two parameters one is gridview object and name of the excel file. This function generates excel file in “.xls” format.

Download Demo Code here --> ExportToExcelDemo.zip
Submit this story to DotNetKicks