This is a migrated thread and some comments may be shown as answers.

Loosing column names through Excel export

2 Answers 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Royal
Top achievements
Rank 1
Royal asked on 29 Jun 2010, 03:49 PM
Hoping I can get some ideas on how to overcome an issue we are experiencing.

I have a Rad Grid that is hidden (visible = false) that returns an Excel export of the output. When the grid is set to visible = false the Excel export looses its column headings.

Any ideas on how to fix this? I would like the column headers to display in the Excel output regardless of the grid being visible or not.

Thanks

2 Answers, 1 is accepted

Sort by
0
Royal
Top achievements
Rank 1
answered on 30 Jun 2010, 03:41 PM
Just an update, I was able to achieve what I need by adding column headers view a UNION in my Sproc, but I consider this less than ideal since I am looking for a solution that allows me to use the same sproc for both applications (that is visible being set to either true or false).

I also tried putting the RadGrid in a div with visibility set to none, but the Grid control was still putting some jibberish that I couldn't make go away.
0
Daniel
Telerik team
answered on 02 Jul 2010, 08:49 PM
Hello Royal,

You should set Visible="true" before exporting:
protected void Button1_Click(object sender, EventArgs e)
{
    RadGrid1.Visible = true;
    RadGrid1.Rebind();
    RadGrid1.MasterTableView.ExportToExcel();
}

Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Royal
Top achievements
Rank 1
Answers by
Royal
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or