Here I will show how to export a HTML table, grid view controls and image control to Excel sheet.
Here I will show how to export a HTML table, grid view controls and image control to Excel sheet.Download the source code for more details.This article will help explain the following points:
Also this article will help to sort the following issue.
1. Export HTML table content to Excel sheetI have created the following simple HTML table.When I click on the export button, my exported Excel sheet will be:Code
Note: If the table has a CSS class then that CSS class design will not be exported to the Excel sheet.2. Export Grid View to Excel sheetI have created the following simple Grandview.When I click on the export button, I will get the following error.To fix this error, add the following function.Final output:Code
3. Export server-side controls and image to Excel sheetI have created an image and a button and I need to export these to an Excel sheet.When I click on the export button, I will get the following error:To fix this error, add the following function:When you click again on the export button, you will get the following error:This error has occurred because of the “button” control. To fix this error, add the following attribute:Final output:Code:
NOTE
ASP.NET GridView Control Pocket Guide