Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 1st, 2008, 10:01 AM
Authorized User
Join Date: May 2007
Posts: 95
Thanks: 5
Thanked 0 Times in 0 Posts
Default Gridview data export to excel sheet

Hi all

I am developing web app using C# 2.0,ASP.NET 2.0,SQL Server 2005.
i am exporting my gridview content to excel sheet using the following code:

   protected void btnExcel_Click(object sender, EventArgs e)
        tdExcel.Visible = false;
        tdExcel2.Visible = false;
        strExcel = "Excel";
        Response.ContentType = "application/x-msdownload";
        Response.AddHeader("content-disposition", "attachment;filename=Transfer_Report.xls");
        Response.ContentType = "application/vnd.ms-excel";
        Response.Charset = string.Empty;

in the excel sheet i am trying to display only the table having records, so i am hiding all the images. I am successful in doing that but the problem is that my gridview paging is enabled(it has to be there because of hundreds of pages), Due to this in my excel sheet page numbers are coming along with the table. How to hide the gridview page numbers before exporting to excel sheet?


Old August 1st, 2008, 10:10 AM
samjudson's Avatar
Friend of Wrox
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts

Have you searched the internet for this, as there are literally 100's of solutions out there for just this issue.


/- Sam Judson : Wrox Technical Editor -/

Similar Threads
Thread Thread Starter Forum Replies Last Post
Export Values to Excel Sheet from Sub form ayazhoda Access VBA 3 June 12th, 2012 03:18 PM
Export GridView data to Excel file rao965 ASP.NET 2.0 Professional 0 June 14th, 2007 10:18 AM
Export data from a datalist to an Excel sheet see07 ASP.NET 1.x and 2.0 Application Design 3 February 23rd, 2007 07:20 PM
How To Export a specific Excel Sheet as a csv file mrjits Excel VBA 5 August 1st, 2006 03:04 PM
Export Image to Excel sheet haribala.raj General .NET 0 September 13th, 2005 11:56 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.