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

Hierarchical grid summarize totals of child tables

1 Answer 70 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Stephan
Top achievements
Rank 1
Stephan asked on 21 Nov 2008, 10:41 AM
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.

Thanks

1 Answer, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 25 Nov 2008, 02:58 PM
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.

Greetings,
Martin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Stephan
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Share this question
or