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

Aggregate Sum Using

1 Answer 39 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Mike asked on 23 Feb 2014, 04:49 AM
I thought I had this but I think I'm missing something.

I think I read somewhere FooterTemplate doesn't work.  Is this correct?

I can count using ClientFooterTemplate, but when I sum the value appears to be concatenating.

Any assistance would be helpful.  Thanks in advance.

Here's what I have:

    @(Html.Kendo.Grid(Of Venable.KMVC.ClientPortfolio.ADRServiceReference.Activity)() _
            .Name("clientActivityYear") _
                    End Sub) _
                             c.Bound(Function(p) p.Year).FooterTemplate("LTD")
                             c.Bound(Function(p) p.WorkedActivity).Title("Worked").HtmlAttributes(New With {.style = "text-align: right"}).ClientFooterTemplate("#=sum#")
                             c.Bound(Function(p) p.BilledActivity).Title("Billed").HtmlAttributes(New With {.style = "text-align: right"})
                             c.Bound(Function(p) p.CollectedActivity).Title("Collected").HtmlAttributes(New With {.style = "text-align: right"})
                     End Sub) _
        .Selectable(Function(selectable) selectable.Mode(GridSelectionMode.Single)) _
        .Scrollable() _
                                                                               aggregates.Add(Function(p) p.WorkedActivity).Sum()
                                                                               aggregates.Add(Function(p) p.BilledActivity).Sum()
                                                                               aggregates.Add(Function(p) p.CollectedActivity).Sum()
                                                                       End Sub) _
                            .Read(Function(read) read.Action("ActivityRead", "Home").Data("addData"))
                    End Sub)

1 Answer, 1 is accepted

Sort by
Alexander Popov
Telerik team
answered on 26 Feb 2014, 07:52 AM
Hi Mike,

Basically the difference between a Template and ClientTemplate is where it is executed. As the name suggests, the client template is rendered on the client-side and uses Kendo UI template syntax. In contrast, the FooterTemplate is executed on the server and uses Razor (or ASPX) syntax. Since the Grid uses Ajax instead of Server binding I would recommend using client templates.
Regarding your second question - the Sum aggregate will concatenate the values in case they are not of numeric type, and this is the expected behavior.  

Alexander Popov
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Asked by
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question