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

Export only the header row

3 Answers 115 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Davide
Top achievements
Rank 1
Davide asked on 18 Jan 2013, 03:01 PM
Hello,
as you can see in the object I can get only the first row, the headers row.
I tried everything: export to Excel, export to CSV, export to HTML, export to PDF. Each time I get a file in the desidered format (without problem) but with only one line, the headers line.
This is my scenario:
I have a Win Form wich contains a RadGridView control that I populate via code (something like your demos).
In the form there is a button that open a dialog form (I need to give some option to the customers before create the exported file).
In the dialog form there is all the routines to generate the desired file. For example:
Private Sub RunExportToCSV(ByVal fileName As String)
 
       Dim MyCsvExporter As New ExportToCSV(m_CurrentGrid)
 
      MyCsvExporter.SummariesExportOption = SummariesOption.ExportAll
 
      MyCsvExporter.HiddenColumnOption = HiddenOption.DoNotExport
  
      Try
 
          MyCsvExporter.RunExport(fileName)
 
       Catch ex As IOException
 
          MessageBox.Show(Me, ex.Message, "I/O Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
 
       End Try
 
   End Sub


Here's what I'm using:
.NET 4
Visual Studio 2010
Telerik Win Controls 2012.3.1211.40

Please help me, I'm getting crazy!.
Best Regards.
Davide

3 Answers, 1 is accepted

Sort by
0
Davide
Top achievements
Rank 1
answered on 18 Jan 2013, 03:33 PM
Additional informations:
Maybe you need to know that I'm not setting the DataSource property of the RadGridView but I populate the grid by adding a corresponding GridViewRowInfo for each object that I need to show in the grid.
Is that a problem?

Thank you
Davide

0
Accepted
Ivan Petrov
Telerik team
answered on 23 Jan 2013, 01:35 PM
Hi Davide,

Thank you for writing.

In order for the export to function properly you should be adding the rows to RadGridView's rows collection using the Add(ParamArray values As Object) method. This will ensure all the data is stored properly in the data layer of RadGridView. 

I hope this will be useful. Should you have further questions, I would be glad to help.

Regards,
Ivan Petrov
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Davide
Top achievements
Rank 1
answered on 23 Jan 2013, 04:57 PM
Thank you very much. Now it works fine! I can export everything.
Regards
Davide
Tags
GridView
Asked by
Davide
Top achievements
Rank 1
Answers by
Davide
Top achievements
Rank 1
Ivan Petrov
Telerik team
Share this question
or