This is a migrated thread and some comments may be shown as answers.
Hidden grid export to Excel not displaying grid headers in Excel
1 Answer 15 Views
This is a migrated thread and some comments may be shown as answers.
Brendan Vogt
Top achievements
Rank 1
Brendan Vogt asked on 30 Nov 2010, 12:59 PM
Hi,

I struggled to get the correct data to export to Excel.  I needed some extra columns to be added and some that needed to be hidden that what was already displaying on the screen.  So what I did was to create another grid, populate it with data and to hide it from the user.  When I click on the link it exports the data to Excel, but when I open the Excel document then there is no headers in the spreadsheet?  I need the headers to display.  Here is my code:

achieverList = // Get the list of achievers from the database

gvExelExport.DataSource = achieverList;
gvExelExport.DataBind();
// Export to Excel
gvExelExport.ExportSettings.IgnorePaging = true;
gvExelExport.ExportSettings.OpenInNewWindow = true;
gvExelExport.MasterTableView.ExportToExcel();

What do I need to do to display the headers?

Thanks
Brendan

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 03 Dec 2010, 01:11 PM
Hello Brendan,

This is known limitation. You can easily sidestep the unwanted behavior by setting the Visible property to true when exporting.

Note, that you do not have to set the aforementioned property back to true since the response is redirected to the file and these changes won't affect your page.

Regards,
Daniel
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Brendan Vogt
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or