Follow the steps involved :
Create a aspx page with a grid view control.
Add the code for the button click in ViewExcelReport.aspx.cs
Now you are done, you can export the grid view in to Excel format.
if you’re getting any error message like
RegisterForEventValidation can only be called during Render();
To solve, add the overriding function VerifyRenderingInServerForm event in code.
Thanks for reading this article!! please leave your comments and suggestion about this article.