Exporting GridView with Mutiple Child Templates using Interop.Excel

2 posts, 0 answers
  1. Doug
    Doug avatar
    10 posts
    Member since:
    Dec 2011

    Posted 21 May 2012 Link to this post

    I am exporting a GridView that contains 2 child templates. However, I am not using the ExportToExcelML to perform the export. I am using Interop.Excel.

    The two child templates are displayed at the same hierarchical level. Currently, I am using "foreach" to step through each row in the parent template and write its data to the Excel sheet.

    I'm having trouble stepping through the related rows in each child template once I have the GridViewRowInfo of the parent row inside the "foreach". I can't seem to find an efficient way to access the rows of each template that directly relate to the current parent row. The ChildRows collection only seems to contain the rows of the first template.

    Is there a built-in method or an elogant approach I could use to step through the child rows of each child template?

    My current setup is as follows:
    foreach (GridViewRowInfo row in gridView.Rows)
    {
       //Write parent row data to Excel sheet
     
       //Access each child template either with a loop or explicitly
      
       //Step through child template's rows and write the row data to the Excel sheet
    }

  2. Ivan Petrov
    Admin
    Ivan Petrov avatar
    705 posts

    Posted 23 May 2012 Link to this post

    Hello Doug,

    Your question has already been answered in the other thread you have opened. Please, see our answer there for more information.

    We would like to kindly ask you to use just one support channel to contact us. Posting the same question more than once slows down our response time because we will need to review and address two or more threads instead of one. Furthermore, please have in mind that support threads are handled according to the license type and time of posting, so if it is an urgent issue, we suggest that you use a support ticket, which would be handled before a forum thread.

    Regards,
    Ivan Petrov
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top