Export only the header row

4 posts, 1 answers
  1. Davide
    Davide avatar
    5 posts
    Member since:
    Oct 2012

    Posted 18 Jan 2013 Link to this post

    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
  2. Davide
    Davide avatar
    5 posts
    Member since:
    Oct 2012

    Posted 18 Jan 2013 Link to this post

    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

  3. Answer
    Ivan Petrov
    Admin
    Ivan Petrov avatar
    717 posts

    Posted 23 Jan 2013 Link to this post

    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.
  4. Davide
    Davide avatar
    5 posts
    Member since:
    Oct 2012

    Posted 23 Jan 2013 Link to this post

    Thank you very much. Now it works fine! I can export everything.
    Regards
    Davide
Back to Top