Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The ToDataSourceResult() method should support aggregates with DataTables for ASP.NET Core #4798

Alex-Bubblemaster opened this issue Jan 25, 2019 · 2 comments


Copy link

commented Jan 25, 2019


Ticket ID: 1384643

Reproduction of the problem

Create a grid using DataTables. Add agggregates to the data source:

           .Aggregates(aggregates =>
               foreach (System.Data.DataColumn column in Model.Columns)
                   if (column.DataType == typeof(int))
                       aggregates.Add(column.ColumnName, typeof(int)).Sum();
                   if (column.DataType == typeof(string))
                       aggregates.Add(column.ColumnName, typeof(int)).Count();

An error is thrown:

Stack trace

Expected/desired behavior

The aggregates should be calculated correctly


  • add a System.Data.DataSetExtensions.dll and use the .AsEnumerable() method

  • specify the fields and object types. While this takes away from the dynamic definition, it is a way to use the grid at present with aggregates

        public IActionResult Read([DataSourceRequest] DataSourceRequest request)
            var res = GetDataTable(500).AsEnumerable().Select(x=> new {                
                Field1 = x.Field<string>("Field1"),
                Field2 = x.Field<int>("Field2")
            return Json(res.ToDataSourceResult(request));


  • Kendo UI version: 2019.1.115

This comment has been minimized.

Copy link

commented Apr 15, 2019

Reported again in ticket 1404416


This comment has been minimized.

Copy link

commented Jun 28, 2019

Also requested in 1413810. Raising priority

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.