Export Child RadGrid of RowDetailsTemplate does not work fine with Export.ToHTML

2 posts, 0 answers
  1. Inderpal
    Inderpal avatar
    6 posts
    Member since:
    Jun 2014

    Posted 03 Jul 2014 Link to this post

    Hello Guys,

    So i have one parent radgrid and i have one datatemplate which has one other child radgrid inside that template which i have assigned asRowDetailsTemplate of parent grid so every row of my parent radgrid will have one child radgrid.

    So now I want to export the data of radgrid so with parent radgrid i want to export child radgrid data also. So i have seen many forums which says that it is possible in the below link http://www.telerik.com/forums/export-hierarchical-radgridview

    So when i call export method from parent radgrid with export format as CSV and subexports child grid with export.ToCSV method then it works perfectly for CSV but if i used export format for HTML and subexports child grid with export.ToHtml method then it is not working correctly  disturbs my parent radgrid data so after all child radgrid my parent radgrid full data comes in one cell so one full row data comes in one cell instead of getting the value in different cell.

    I have attached the image for the same and have marked the box as green for parent data coming correctly and red for the other parent data after child grid which is not coming correctly.

    I would really appreciate if someone could help me out with this.

    Thanks in advance.
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1219 posts

    Posted 03 Jul 2014 Link to this post

    Hello,

    The approach illustrated in the thread that you have mentioned is applicable only for CSV export, as the CSV format does not apply any restrictions other that using a valid separation token. On the other hand html implies that a specific document structure should be followed. RadGridView's html export generates an html table (<table>) that arranges cells and their content (<td>) in the respective rows (<tr>). If the mentioned approach is follwed, you will have something like this:
    <table>
    . . .
    <tr><td>. . .</td></tr>
    <table> . . . </table>
    <tr><td>. . .</td></tr>
    </table>
    This is not a valid document structure, so that Excel fails to render it. You have to wrap the inner table into "<tr><td colspan="?">...</td></tr> to make it work properly.

    Regards,
    Ivan Ivanov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top