Hierarchical grid summarize totals of child tables

2 posts, 0 answers
  1. Stephan
    Stephan avatar
    71 posts
    Member since:
    Jul 2007

    Posted 21 Nov 2008 Link to this post

    Hi, I just don't know where to start, so I turn to you.

    I need to bind a grid to hierarchical data. Which goes to three nested levels deep. On every level I need to summarize the totals of the childtables. It more like a tree view of the dataset including totals for rows.

    So on the highest level I would see the totals of all childtables.

    My guess would be that I add a custom row at the end of each childtable in the view which would hold the totals of the childtables.

    I should also be possible to export this grid to Excell. would that be a problem, concerning the custom added total rows?

    Hope you can point me in the right direction.


  2. Martin Vasilev
    Martin Vasilev avatar
    1061 posts

    Posted 25 Nov 2008 Link to this post

    Hi Stephan,

    Thank you for writing.

    RadGridView does not support build-in summaries, counted on child views. Nevertheless, your suggestion on adding custom rows that contain the needed data can be done. Here is a sample code on how to add a new row that displays the count of the child rows:
    GridViewDataRowInfo rowInfo = this.radGridView1.MasterGridViewTemplate.Rows.AddNew(); 
    rowInfo.Cells[2].Value = String.Format("Count child: {0}"this.radGridView1.MasterGridViewTemplate.ChildGridViewTemplates[0].RowCount); 

    This is only an example. You should implement your own logic to handle the needed summaries and add them to your custom row.

    You could export your RadGridView into Excel, but only the MasterTemplate data, including the custom added rows.

    If you have other questions, do not hesitate to contact me again.

    Martin Vasilev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top