Click here to Skip to main content
16,008,469 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a gridview with data on ASP.NET page. I want to export it to a workbook which is existed in project.
after putting data into it I want to download the file to local machine.

Hope i am making sense..
Posted

1 solution

go through following link..
Export Gridview Data to Excel in ASP.NET[^]
http://www.aspdotnet-suresh.com/2011/04/how-to-export-gridview-data-to-excel-or.html[^]
and for download use following code
C#
Response.Clear();
Response.AddHeader("content-disposition", "attachment; filename=nameOfExcelFile.xls");
Response.ContentType = "application/vnd.ms-excel";
Response.WriteFile(FileFullPath, true);//get FileFullPath by server.MapPath which u have created
Response.Flush();
Response.End();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900