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

[Solved] Remove columns between Excel & CSV Export

2 Answers 296 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kurt Kluth
Top achievements
Rank 1
Kurt Kluth asked on 19 Mar 2013, 05:01 PM
I return data to a RadGrid and would like to give the user the option to either export it to a CSV and/or Excel file.  The CSV file would only provide them limited fields that they would need in order to import it into another application.  The Excel version would contain all the columns displayed in the Grid. 

I am currently able to give them the Excel file but is this possible to give them the CSV file using the same grid results only exporting preselected columns?  If so, how would I go about doing this?

Also, is it possible to display the filters (using radFilter) that were applied on the exported file?

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 20 Mar 2013, 06:29 AM
Hi,

I suppose you want to hide the columns before exporting. Here is the sample code.
C#:
protected void Button2_Click(object sender, EventArgs e)
{
        RadGrid1.MasterTableView.GetColumn("UNiqueName").Visible = false;
        RadGrid1.ExportSettings.ExportOnlyData = false;
        RadGrid1.MasterTableView.ExportToExcel(); 
        RadGrid1.MasterTableView.Rebind();
}

Thanks,
Shinu
0
Kurt Kluth
Top achievements
Rank 1
answered on 20 Mar 2013, 01:34 PM
Shinu,

Thank you for your help as that was extremely helpful.

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