0

I am trying to get a sum of all "TransactionAmount"s in the kendo grid I have created. I have the following code and I am getting a JavaScript error saying the 'sum' is undefined.

Could you please tell me what I am doing wrong?

<%: Html.Kendo().Grid<Transactions>()
                        .Name("grid_#=AccountNumber#")
                        .Columns(c =>
                        {
                            c.Bound(m => m.TDate).Title("Transaction Date").ClientFooterTemplate("Total:");
                            c.Bound(m => m.TransactionAmount).Title("Transaction Amount").Format("{0:c}").ClientFooterTemplate("#= sum #");
                            c.Bound(m => m.UserName)
                            c.Bound(m => m.Address1)
                            c.Bound(m => m.City)
                            c.Bound(m => m.State)
                        })
                        .DataSource(dataSource => dataSource
                            .Ajax()
                            .Aggregates(v => { v.Add(p => p.TransactionAmount).Sum(); })
                            .Read(read => read.Action("GetTransactions", "Reports", new { startDate = Model.StartDate, endDate = Model.EndDate, accountNumber = "#=AccountNumber#" })) 
                        )
                        .Sortable()
                        .ToClientTemplate(#=sum#)  
            %>
user317891
  • 23
  • 1
  • 6
  • Hi thanks for your response. I noticed a problem with my original question so i edited it to include the correct code. I'm really a c# developer who was recently thrown into the web world and honestly I'm not exactly sure of the relationships either. A lot of what I have done is from following examples and copy/paste. I found this in the kendo demos on telerik's site. This is the example i'm following: http://demos.telerik.com/kendo-ui/grid/aggregates Thanks for your help :) – user317891 Jun 30 '14 at 14:58
  • you last line of code `ToClientTemplate(#=sum#)` doesn't look valid – CSharper Jun 30 '14 at 17:44

0 Answers0