I have followed the info in http://www.telerik.com/community/forums/aspnet-ajax/grid/custom-aggregate-on-a-templated-column-with-grouping.aspx
it helps but doesn't get me quite where I need to be. I have a grid which I can declaratively group by at a couple of levels - bascially order lines within order reference within period. I have one column which is the currency equivalent for each line and this value is calculated in the ItemdataBound event.
I want either the Group Header or the Group Footer to show me the sum of this column and for the interim sums to also be shown - eg total value of each order reference at the innermost level and also total value of all orders in the period in the main group. Ideally if the user elects to drah and drop other groupings I would want the totals to be rolled up accordingly.
The sample code in teh forum msg above has two probs - one it seems to only work at the innermost level ie the outermost group header doesn't recursively sum everything below it. And two it seems to overwrite the group header text so any other useful text is lost to the label that is created in the code.
Is there any way to declaratively specify an aggregate on the template column?
T
it helps but doesn't get me quite where I need to be. I have a grid which I can declaratively group by at a couple of levels - bascially order lines within order reference within period. I have one column which is the currency equivalent for each line and this value is calculated in the ItemdataBound event.
I want either the Group Header or the Group Footer to show me the sum of this column and for the interim sums to also be shown - eg total value of each order reference at the innermost level and also total value of all orders in the period in the main group. Ideally if the user elects to drah and drop other groupings I would want the totals to be rolled up accordingly.
The sample code in teh forum msg above has two probs - one it seems to only work at the innermost level ie the outermost group header doesn't recursively sum everything below it. And two it seems to overwrite the group header text so any other useful text is lost to the label that is created in the code.
Is there any way to declaratively specify an aggregate on the template column?
T
9 Answers, 1 is accepted
0
Hello Mark H,
Specifying declarative aggregates for RadGrid template columns is not supported by our web grid. You may consider the programmatic approach from the forum thread you pointed or use built-in GridCalculatedColumn (if appropriate) to calculate the currency equivalent and group by its values in a declarative manner.
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.
Specifying declarative aggregates for RadGrid template columns is not supported by our web grid. You may consider the programmatic approach from the forum thread you pointed or use built-in GridCalculatedColumn (if appropriate) to calculate the currency equivalent and group by its values in a declarative manner.
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.
0
Mark H
Top achievements
Rank 1
answered on 09 Jul 2009, 10:46 AM
Thanks Sebastian,
I'm currently using the code route - however I need a clue how to make this work for parent group headers - ie the supplied example I referenced works fine for a group header with data rows as children but I need to make sure that if I have multiple group levels that the aggregation works all the way up the chain - how do I do this?
Mark
I'm currently using the code route - however I need a clue how to make this work for parent group headers - ie the supplied example I referenced works fine for a group header with data rows as children but I need to make sure that if I have multiple group levels that the aggregation works all the way up the chain - how do I do this?
Mark
0
Hello Mark H,
If you stick to the programmatic approach, you will need to implement your custom complex logic which to propagate the calculated aggregates when having several nested levels of grouping. This is not necessary if you consider using built-in GridCalculatedColumn since the aggregated values for that column will be re-calculated automatically.
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.
If you stick to the programmatic approach, you will need to implement your custom complex logic which to propagate the calculated aggregates when having several nested levels of grouping. This is not necessary if you consider using built-in GridCalculatedColumn since the aggregated values for that column will be re-calculated automatically.
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
Mark H
Top achievements
Rank 1
answered on 11 Jul 2009, 11:02 AM
OK I'm trying that but I'm seeing some odd behaviour.
I'm hooking ItemDataBound and when I just have GridBoundColumns and GridTemplateColumns in my collection I find that e.Item.DataItem can be cast and used as a DataRowView which is very handy. However as soon as I make one of the columns a GridCalculatedColumn my cast fails and the debugger tells me I'm getting a DynamicClass1 passed in teh DataItem member instead - is this correct and where can I find docs on it? It means I'm now potentially going to have to change all my code that was checking fields in the DataRowView :(
Mark
I'm hooking ItemDataBound and when I just have GridBoundColumns and GridTemplateColumns in my collection I find that e.Item.DataItem can be cast and used as a DataRowView which is very handy. However as soon as I make one of the columns a GridCalculatedColumn my cast fails and the debugger tells me I'm getting a DynamicClass1 passed in teh DataItem member instead - is this correct and where can I find docs on it? It means I'm now potentially going to have to change all my code that was checking fields in the DataRowView :(
Mark
0
Hello Mark H,
In case you use the .NET 3.5 build of Telerik.Web.UI.dll, can you please check whether the same behavior happens when you set the EnableLinqExpressions property of the grid to false? With this build by default LINQ queries will be used to generate the expression for the GridCalculatedColumn and in this way you will force it to apply the .NET 2.x syntax for them, thus keeping the DataItem of type DataRowView.
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.
In case you use the .NET 3.5 build of Telerik.Web.UI.dll, can you please check whether the same behavior happens when you set the EnableLinqExpressions property of the grid to false? With this build by default LINQ queries will be used to generate the expression for the GridCalculatedColumn and in this way you will force it to apply the .NET 2.x syntax for them, thus keeping the DataItem of type DataRowView.
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
Andriy Mudriy
Top achievements
Rank 1
answered on 20 Dec 2011, 06:33 PM
Could you please clarify us can we use aggregation for GridTemplateColumn in last Telerik version? Thanks.
0
Hello Andriy,
The concepts for supporting aggregates with templated and calculated grid columns explained in this forum thread are still applicable. Consider the solutions suggested below and choose the most appropriate one for your scenario.
Best regards,
Sebastian
the Telerik team
The concepts for supporting aggregates with templated and calculated grid columns explained in this forum thread are still applicable. Consider the solutions suggested below and choose the most appropriate one for your scenario.
Best regards,
Sebastian
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
J2K
Top achievements
Rank 1
answered on 08 Oct 2015, 10:43 AM
Incredibly lame. Another reason not use to Telerik controls. Thank you.
0
Hello,
I am not sure exactly what you want to achieve, however, the following definition should work correctly with aggregates:
Hope this helps.
Regards,
Eyup
Telerik
I am not sure exactly what you want to achieve, however, the following definition should work correctly with aggregates:
<
telerik:GridTemplateColumn
DataField
=
"Freight"
DataType
=
"System.Decimal"
FilterControlAltText
=
"Filter Freight column"
HeaderText
=
"Freight"
SortExpression
=
"Freight"
UniqueName
=
"Freight"
Aggregate
=
"Sum"
>
<
ItemTemplate
>
<
asp:LinkButton
ID
=
"LinkButton1"
runat
=
"server"
Text='<%# Eval("Freight") %>'>
</
asp:LinkButton
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
Hope this helps.
Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items