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

exporting radgrid to csv without headers

1 Answer 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Edd
Top achievements
Rank 1
Edd asked on 17 Sep 2014, 06:01 PM
Hi all,
 
I have a radgrid which i want to export to csv. But my problem is i want to hide the headers when exporting. How can i acheive this??
below are the codes am trying to use

if (e.CommandName == RadGrid.ExportToCsvCommandName)
           {
 
               GridHeaderItem HeaderItem = (GridHeaderItem)RadGrid1.MasterTableView.GetItems(GridItemType.Header)[0];
                HeaderItem.Visible = false;
           }
 any help

1 Answer, 1 is accepted

Sort by
0
Troy
Top achievements
Rank 1
answered on 30 Sep 2014, 06:54 PM
Hi Edd,  had the same problem here and tried a lot of things. 
This works, should be a better way I think but...

        'gr' references my grid,  'Xport' is my ExportToCSV object

Try
    gr.ShowColumnHeaders = False
    Xport.HiddenRowOption = HiddenOption.DoNotExport
    Xport.SummariesExportOption = SummariesOption.DoNotExport
    Xport.RunExport(FileName)
    gr.ShowColumnHeaders = True
    MessageBox.Show("Payroll file Exported...", "Export File", MessageBoxButtons.OK, MessageBoxIcon.Information)

I'm having to hide the column headers on the Grid itself, Export, then show the Column Headers...
Tags
Grid
Asked by
Edd
Top achievements
Rank 1
Answers by
Troy
Top achievements
Rank 1
Share this question
or