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

[Solved] Hide column in CSV export

2 Answers 364 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 06 Oct 2009, 08:47 AM
Hi All,

I have a CSV export ability in many of my RadGrids.  When I export I notice that template columns with images in them get included in the export - they are displayed as empty columns.  How do I hide the columns?  I've tried setting visible = false to the column before the export and then re-enabling after the export is called.

Any ideas?

Regards,

Jon

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 06 Oct 2009, 11:23 AM
Hi Jon,

Try the following code snippet in order to hide the template column while exporting.

C#:
 
protected void Button1_Click(object sender, EventArgs e) 
    RadGrid1.ExportSettings.OpenInNewWindow = true
    RadGrid1.ExportSettings.ExportOnlyData = true
    RadGrid1.ExportSettings.IgnorePaging = true
    RadGrid1.MasterTableView.GetColumn("TemplateColumnUniqueName").Visible = false; // Hide the column when exporting
    RadGrid1.MasterTableView.ExportToCSV(); 

-Shinu.
0
Jon
Top achievements
Rank 1
answered on 06 Oct 2009, 01:18 PM
Hi Shinu,

Many thanks for that - it was pretty much what I was doing but after checking my code I removed the visible=true flag on the column that I had put in AFTER the Export function - I was assuming that I needed that so the column displayed on the page - I didn't.

Thanks for your help,

Regards,

Jon
Tags
Grid
Asked by
Jon
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jon
Top achievements
Rank 1
Share this question
or