Home >> ASP.NET >> Export to Excel from DataGridView in ASP.NET

Export to Excel from DataGridView in ASP.NET


We are going to learn how to Export GridView data to Microsoft Excel at Runtime.

We are using:
ASP.NET Framework 4.0, Visual Studio 2010, SQL Server 2008, C#, XHTML 4.01

Code for ASPX Page (Front-End)
Adding GridView and Columns:

Adding Export Link

<asp:LinkButton ID="lnkExport" runat="server" Text="Export to Excel" onclick="lnkExport_Click"></asp:LinkButton>

Now Code for ASPX.CS Page (BackEnd):

Namespaces :

Data Binding and Export LinkButton Click Event:

I will be waiting to Listen from you….

John Bhatt

About John Bhatt

Aka, Prithvi Raj Bhatt, A Proud Nepali, Blogger, Software Developer, ASP.NET, Web Designer & Developer, Faculty and a Troubleshooter blog @PRsBlog

Check Also


How to enable Developer Tab in Microsoft Excel

Microsoft Excel is one of the most powerful application software that Microsoft made. We can …

Leave a Reply

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