This is a migrated thread and some comments may be shown as answers.
Can't Aggregate - compiler error
0 Answers 23 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Top achievements
Rank 1
Jon asked on 17 Mar 2011, 10:11 PM
I've had a grid working successfully for a while. Today I decided to add grouping and aggregates.

The grouping works great, but when I try to add aggregates I get the following error: 'Telerik.Web.Mvc.UI.Fluent.GridBoundColumnBuilder<MyViewModel>' does not contain a definition for 'Aggregate' and no extension method 'Aggregate' accepting a first argument of type 'Telerik.Web.Mvc.UI.Fluent.GridBoundColumnBuilder<MyViewModel>' could be found (are you missing a using directive or an assembly reference?)

Am I missing something? Here's a code snippet:

<% Html.Telerik().Grid(Model)
     .Groupable(grouping => grouping
         .Groups(groups =>
             //Group by County
     .ClientEvents(events => events.OnEdit("Grid_onEdit").OnError("onError"))
     .DataKeys(dK => dK.Add(t => t.timeJournalID))
     .DataBinding(dataBinding => dataBinding
         //Ajax Binding
         //TimePunches.Test renders the grid initially
           .Select("_AjaxBinding", "Home")
         //TimePunches.Insert inserts a new data record
           .Insert("_Insert", "Home")
         //TimePunches.Update updates an existing data record
           .Update("_Update", "Home")
         //TimePunches.Delete deletes an existing data record
           .Delete("_Delete", "Home")
     .Editable(editing => editing.Mode(GridEditMode.InLine).DisplayDeleteConfirmation(true))
     .Columns(columns =>
         columns.Bound(tp => tp.workDt).Title("Work Date").Format("{0:MM/dd/yy}").Width(200);
         columns.Bound(tp => tp.projectID).Title("Project").Width(200).ClientTemplate("<#= projects[projectID] #>").Template(tp =>
             // We are mapping project ID to project description
                 <%= ((IEnumerable<ProjectDD>)ViewData["projects"]).FirstOrDefault(p => p.projectID == tp.projectID).projectName%>
         columns.Bound(tp => tp.workDescription).Title("Work Description").Width(200);
         columns.Bound(tp => tp.workLocationState).Title("Location").Width(150);
         columns.Bound(tp => tp.workHours).Aggregate(aggregates => aggregates.Sum()).Title("Hours");
         columns.Command(commands => { commands.Edit(); commands.Delete(); }).Width(200);

Asked by
Top achievements
Rank 1
Share this question