Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 1st, 2008, 10:01 AM
Authorized User
Join Date: May 2007
Location: Hyderabad, Andhra Pradesh, India.
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?


  #2 (permalink)  
Old August 1st, 2008, 10:10 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
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 -/

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 07:54 PM.

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