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

[Solved] Grouping Aggregation - Dynamic Columns

3 Answers 301 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 07 May 2009, 01:39 PM
I'm binding a datatable to a radgrid that has 2 consistant columns but there are then 1 to n number of columns that have integers in. I want to total these up in the footer (group and overall footers) and then have a column at the far right that also tallys them up (so I have totals for horizontal and vertical and overal total in the bottom right).
I've looked in pretty much every event (column creating / column created etc) to do this, but cannot find anyway sum up these values into the footer / dynamic column.

Does anyone have any ideas?
Thanks.

3 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 11 May 2009, 02:54 PM
Hello Tom,

Have you considered using the group footers with aggregates feature of our web grid for this purpose? Note that you can combine it with built-in calculated column with appropriate expression set to visualize horizontal totals on a per row basis beside the group/grand totals.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Tom
Top achievements
Rank 1
answered on 11 May 2009, 03:16 PM
Hi Seb,
I've managed to use these columns when the columns are able to be defined in the markup, but when the are auto generated I cannot get it to work.
Can you confirm the methods you described work with auto-generated columns, and if so, where/how do you set the properties (Aggregate etc) in the code behind? As the number and names of the columns returned vary, I cannot pre-empt what the columns are called at the design stage.
Thanks,
Tom
0
Sebastian
Telerik team
answered on 11 May 2009, 03:28 PM
Hello Tom,

The approach should be applicable with auto-generated columns as well. To set their Aggregate property programmatically, you can intercept the ColumnCreated event of the grid as explained in the bottom section of this documentation article.

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Tom
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Tom
Top achievements
Rank 1
Share this question
or