# QueryableExtensions

## Methods

### ToDataSourceResult(System.Data.DataTable,Kendo.Mvc.UI.DataSourceRequest)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty resullt.

#### Parameters

##### dataTable - `System.Data.DataTable`

An instance of System.Data.DataTable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

#### RETURNS

A [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied.

#### Example

```
 
            public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
            {
                 var result = GetOrders().ToDataSourceResult(request);
                 return Json(result);
            }
             
```

### ToDataSourceResultAsync(System.Data.DataTable,Kendo.Mvc.UI.DataSourceRequest)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty resullt.

#### Parameters

##### dataTable - `System.Data.DataTable`

An instance of System.Data.DataTable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 var result = await GetOrders().ToDataSourceResultAsync(request);
                 return Json(result);
             }
             
```

### ToDataSourceResultAsync(System.Data.DataTable,Kendo.Mvc.UI.DataSourceRequest,System.Threading.CancellationToken)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty resullt.

#### Parameters

##### dataTable - `System.Data.DataTable`

An instance of System.Data.DataTable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                  var result = await GetOrders().ToDataSourceResultAsync(request, token);
                  return Json(result);
              }
              
```

### ToDataSourceResult(System.Collections.IEnumerable,Kendo.Mvc.UI.DataSourceRequest)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.IEnumerable`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

#### RETURNS

A [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied.

#### Example

```
 
            public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
            {
                 var result = GetOrders().ToDataSourceResult(request);
                 return Json(result);
            }
             
```

### ToDataSourceResultAsync(System.Collections.IEnumerable,Kendo.Mvc.UI.DataSourceRequest)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.IEnumerable`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 var result = await GetOrders().ToDataSourceResultAsync(request);
                 return Json(result);
             }
             
```

### ToDataSourceResultAsync(System.Collections.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Threading.CancellationToken)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.IEnumerable`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### cancellation - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                  var result = await GetOrders().ToDataSourceResultAsync(request, token);
                  return Json(result);
              }
              
```

### ToDataSourceResult(System.Collections.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.IEnumerable`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

#### RETURNS

A [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied.

#### Example

```
 
            public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
            {
                 var result = GetOrders().ToDataSourceResult(request, ModelState);
                 return Json(result);
            }
             
```

### ToDataSourceResultAsync(System.Collections.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.IEnumerable`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 var result = await GetOrders().ToDataSourceResultAsync(request, ModelState);
                 return Json(result);
             }
             
```

### ToDataSourceResultAsync(System.Collections.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Threading.CancellationToken)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.IEnumerable`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### cancellation - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                  var result = await GetOrders().ToDataSourceResultAsync(request, ModelState, token);
                  return Json(result);
              }
              
```

### ToDataSourceResult(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

#### RETURNS

A [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied.

#### Example

```
 
            public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
            {
                 var result = GetOrders().ToDataSourceResult(request);
                 return Json(result);
            }
             
```

### ToDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 var result = await GetOrders().ToDataSourceResultAsync(request);
                 return Json(result);
             }
             
```

### ToDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Threading.CancellationToken)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                  var result = await GetOrders().ToDataSourceResultAsync(request, token);
                  return Json(result);
              }
              
```

### ToDataSourceResult(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Func)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### selector - `System.Func<TModel,TResult>`

A projection function to apply to each element.

#### RETURNS

A [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied.

#### Example

```
 
            public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
            {
                 var result = GetOrders().ToDataSourceResult<OrderViewModel, Order>(request, x => new Order()
                 {
                     OrderID = x.OrderID
                 });
                 return Json(result);
            }
             
```

### ToDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Func)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### selector - `System.Func<TModel,TResult>`

A projection function to apply to each element.

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 var result = await GetOrders().ToDataSourceResultAsync<OrderViewModel, Order>(request, x => new Order()
                 {
                     OrderID = x.OrderID
                 });
                 return Json(result);
             }
             
```

### ToDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Func,System.Threading.CancellationToken)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### selector - `System.Func<TModel,TResult>`

A projection function to apply to each element.

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                  var result = await GetOrders().ToDataSourceResultAsync<OrderViewModel, Order>(request, x => new Order()
                  {
                      OrderID = x.OrderID
                  }, token);
                  return Json(result);
              }
              
```

### ToDataSourceResult(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

A projection function to apply to each element.

#### RETURNS

A [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied.

#### Example

```
 
            public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
            {
                 var result = GetOrders().ToDataSourceResult<OrderViewModel, Order>(request, ModelState, x => new Order()
                 {
                     OrderID = x.OrderID
                 });
                 return Json(result);
            }
             
```

### ToDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

A projection function to apply to each element.

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 var result = await GetOrders().ToDataSourceResult<OrderViewModel, Order>(request, ModelState, x => new Order()
                 {
                     OrderID = x.OrderID
                 });
                 return Json(result);
             }
             
```

### ToDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func,System.Threading.CancellationToken)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

A projection function to apply to each element.

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                  var result = await GetOrders().ToDataSourceResultAsync<OrderViewModel, ModelState, Order>(request, x => new Order()
                  {
                      OrderID = x.OrderID
                  }, token);
                  return Json(result);
              }
              
```

### ToDataSourceResult(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Func)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### selector - `System.Func<TModel,TResult>`

A projection function to apply to each element.

#### RETURNS

A [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied.

#### Example

```
 
            public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
            {
                 var result = GetOrders().ToDataSourceResult<OrderViewModel, Order>(request, x => new Order()
                 {
                     OrderID = x.OrderID
                 });
                 return Json(result);
            }
             
```

### ToDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Func)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

##### selector - `System.Func<TModel,TResult>`

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 var result = await GetOrders().ToDataSourceResultAsync<OrderViewModel, Order>(request, x => new Order()
                 {
                     OrderID = x.OrderID
                 });
                 return Json(result);
             }
             
```

### ToDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Func,System.Threading.CancellationToken)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

##### selector - `System.Func<TModel,TResult>`

##### cancellationToken - `System.Threading.CancellationToken`

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                  var result = await GetOrders().ToDataSourceResultAsync<OrderViewModel, Order>(request, x => new Order()
                  {
                      OrderID = x.OrderID
                  }, token);
                  return Json(result);
              }
              
```

### ToDataSourceResult(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

A projection function to apply to each element.

#### RETURNS

A [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied.

#### Example

```
 
             public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 var result = await GetOrders().ToDataSourceResult<OrderViewModel, Order>(request, ModelState, x => new Order()
                 {
                     OrderID = x.OrderID
                 });
                 return Json(result);
             }
             
```

### ToDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

A projection function to apply to each element.

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 var result = await GetOrders().ToDataSourceResultAsync<OrderViewModel, Order>(request, ModelState, x => new Order()
                 {
                     OrderID = x.OrderID
                 });
                 return Json(result);
             }
             
```

### ToDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func,System.Threading.CancellationToken)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

A projection function to apply to each element.

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                  var result = await GetOrders().ToDataSourceResultAsync<OrderViewModel, ModelState, Order>(request, x => new Order()
                  {
                      OrderID = x.OrderID
                  }, token);
                  return Json(result);
              }
              
```

### ToDataSourceResult(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

#### RETURNS

A [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied.

#### Example

```
 
             public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 var result = await GetOrders().ToDataSourceResult(request, ModelState);
                 return Json(result);
             }
             
```

### ToDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 var result = await GetOrders().ToDataSourceResultAsync(request, ModelState);
                 return Json(result);
             }
             
```

### ToDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Threading.CancellationToken)

Applies paging, sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [DataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourceresult) object, which contains the processed data after paging, sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<IActionResult> Orders_Read([DataSourceRequest] DataSourceRequest request)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                  var result = await GetOrders().ToDataSourceResultAsync<OrderViewModel, ModelState, Order>(request, x => new Order()
                  {
                      OrderID = x.OrderID
                  }, token);
                  return Json(result);
              }
              
```

### Sort(System.Linq.IQueryable,System.Collections.Generic.IEnumerable)

Sorts the elements of a sequence using the specified sort descriptors.

#### Parameters

##### source - `System.Linq.IQueryable`

A sequence of values to sort.

##### sortDescriptors - System.Collections.Generic.IEnumerable<[SortDescriptor](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc/sortdescriptor)>

The sort descriptors used for sorting.

#### RETURNS

An System.Linq.IQueryable whose elements are sorted according to a "sortDescriptors".

#### Example

```
 
             public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 IQueryable<OrderViewModel> orders = GetOrders();
                 var total = orders.Count();
            
                 orders.Sort(request.Sorts);
            
                 var result = new DataSourceResult()
                 {
                     Data = orders,
                     Total = total
                 };
            
                 return Json(result);
             }
              
```

### Page(System.Linq.IQueryable,System.Int32,System.Int32)

Pages through the elements of a sequence until the specified "pageIndex" using "pageSize".

#### Parameters

##### source - `System.Linq.IQueryable`

A sequence of values to page.

##### pageIndex - `System.Int32`

Index of the page.

##### pageSize - `System.Int32`

Size of the page.

#### RETURNS

An System.Linq.IQueryable whose elements are at the specified "pageIndex".

#### Example

```
 
             public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 IQueryable<OrderViewModel> orders = GetOrders();
                 var total = orders.Count();
            
                 orders.Page(request.Page, request.PageSize);
            
                 var result = new DataSourceResult()
                 {
                     Data = orders,
                     Total = total
                 };
            
                 return Json(result);
             }
              
```

### Select(System.Linq.IQueryable,System.Linq.Expressions.LambdaExpression)

Projects each element of a sequence into a new form.

#### Parameters

##### source - `System.Linq.IQueryable`

A sequence of values to project.

##### selector - `System.Linq.Expressions.LambdaExpression`

A projection function to apply to each element.

#### RETURNS

An System.Linq.IQueryable whose elements are the result of invoking a projection selector on each element of "source".

#### Example

```
 
             public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 IQueryable<OrderViewModel> orders = GetOrders();
                 var total = orders.Count();
            
                 orders.Select(x => x.ContactName);
            
                 var result = new DataSourceResult()
                 {
                     Data = orders,
                     Total = total
                 };
            
                 return Json(result);
             }
              
```

### GroupBy(System.Linq.IQueryable,System.Linq.Expressions.LambdaExpression)

Groups the elements of a sequence according to a specified key selector function.

#### Parameters

##### source - `System.Linq.IQueryable`

An System.Linq.IQueryable whose elements to group.

##### keySelector - `System.Linq.Expressions.LambdaExpression`

A function to extract the key for each element.

#### RETURNS

An System.Linq.IQueryable with System.Linq.IGrouping items, whose elements contains a sequence of objects and a key.

#### Example

```
 
             public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 IQueryable<OrderViewModel> orders = GetOrders();
                 var total = orders.Count();
            
                 orders.GroupBy(x => x.ContactName);
            
                 var result = new DataSourceResult()
                 {
                     Data = orders,
                     Total = total
                 };
            
                 return Json(result);
             }
              
```

### OrderBy(System.Linq.IQueryable,System.Linq.Expressions.LambdaExpression)

Sorts the elements of a sequence in ascending order according to a key.

#### Parameters

##### source - `System.Linq.IQueryable`

A sequence of values to order.

##### keySelector - `System.Linq.Expressions.LambdaExpression`

A function to extract a key from an element.

#### RETURNS

An System.Linq.IQueryable whose elements are sorted according to a key.

#### Example

```
 
             public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 IQueryable<OrderViewModel> orders = GetOrders();
                 var total = orders.Count();
            
                 orders.OrderBy(x => x.ContactName);
            
                 var result = new DataSourceResult()
                 {
                     Data = orders,
                     Total = total
                 };
            
                 return Json(result);
             }
              
```

### OrderByDescending(System.Linq.IQueryable,System.Linq.Expressions.LambdaExpression)

Sorts the elements of a sequence in descending order according to a key.

#### Parameters

##### source - `System.Linq.IQueryable`

A sequence of values to order.

##### keySelector - `System.Linq.Expressions.LambdaExpression`

A function to extract a key from an element.

#### RETURNS

An System.Linq.IQueryable whose elements are sorted in descending order according to a key.

#### Example

```
 
             public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 IQueryable<OrderViewModel> orders = GetOrders();
                 var total = orders.Count();
            
                 orders.OrderByDescending(x => x.ContactName);
            
                 var result = new DataSourceResult()
                 {
                     Data = orders,
                     Total = total
                 };
            
                 return Json(result);
             }
              
```

### OrderBy(System.Linq.IQueryable,System.Linq.Expressions.LambdaExpression,System.Nullable)

Calls Kendo.Mvc.Extensions.QueryableExtensions.OrderBy(System.Linq.IQueryable,System.Linq.Expressions.LambdaExpression) or Kendo.Mvc.Extensions.QueryableExtensions.OrderByDescending(System.Linq.IQueryable,System.Linq.Expressions.LambdaExpression) depending on the "sortDirection".

#### Parameters

##### source - `System.Linq.IQueryable`

The source.

##### keySelector - `System.Linq.Expressions.LambdaExpression`

The key selector.

##### sortDirection - System.Nullable<[ListSortDirection](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc/listsortdirection)>

The sort direction.

#### RETURNS

An System.Linq.IQueryable whose elements are sorted according to a key.

#### Example

```
 
             public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 IQueryable<OrderViewModel> orders = GetOrders();
                 var total = orders.Count();
            
                 Expression<Func<OrderViewModel, string>> e = (x) => x.ContactName;
                 orders.OrderBy(e, sortDirection: ListSortDirection.Descending);
            
                 var result = new DataSourceResult()
                 {
                     Data = orders,
                     Total = total
                 };
            
                 return Json(result);
             }
              
```

### GroupBy(System.Linq.IQueryable,System.Collections.Generic.IEnumerable,System.Boolean)

Groups the elements of a sequence according to a specified "groupDescriptors".

#### Parameters

##### source - `System.Linq.IQueryable`

An System.Linq.IQueryable whose elements to group.

##### groupDescriptors - System.Collections.Generic.IEnumerable<[GroupDescriptor](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc/groupdescriptor)>

The group descriptors used for grouping.

##### includeItems - `System.Boolean`

Whether to include individual items in the groups.

#### RETURNS

An System.Linq.IQueryable with IGroup items, whose elements contains a sequence of objects and a key.

#### Example

```
 
             public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 IQueryable<OrderViewModel> orders = GetOrders();
                 var total = orders.Count();
            
                 orders.GroupBy(request.Groups);
            
                 var result = new DataSourceResult()
                 {
                     Data = orders,
                     Total = total
                 };
            
                 return Json(result);
             }
              
```

### GroupBy(System.Linq.IQueryable,System.Linq.IQueryable,System.Collections.Generic.IEnumerable,System.Boolean)

Groups the elements of a sequence according to a specified "groupDescriptors" and allows including or excluding the parents.

#### Parameters

##### source - `System.Linq.IQueryable`

An System.Linq.IQueryable whose elements to group.

##### notPagedData - `System.Linq.IQueryable`

The not paged data.

##### groupDescriptors - System.Collections.Generic.IEnumerable<[GroupDescriptor](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc/groupdescriptor)>

The group descriptors used for grouping.

##### includeItems - `System.Boolean`

The condition for including the parents.

#### RETURNS

An System.Linq.IQueryable with IGroup items, whose elements contains a sequence of objects and a key.

#### Example

```
 
             public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 IQueryable<OrderViewModel> orders = GetOrders();
                 var total = orders.Count();
            
                 orders.GroupBy(orders, request.Groups, true);
            
                 var result = new DataSourceResult()
                 {
                     Data = orders,
                     Total = total
                 };
            
                 return Json(result);
             }
              
```

### Aggregate(System.Linq.IQueryable,System.Collections.Generic.IEnumerable)

Calculates the results of given aggregates functions on a sequence of elements.

#### Parameters

##### source - `System.Linq.IQueryable`

An System.Linq.IQueryable whose elements will be used for aggregate calculation.

##### aggregateFunctions - System.Collections.Generic.IEnumerable<[AggregateFunction](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc/aggregatefunction)>

The aggregate functions.

#### RETURNS

Collection of AggregateResults calculated for each function.

#### Example

```
 
             public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 IQueryable<OrderViewModel> orders = GetOrders();
                 var total = orders.Count();
            
                 orders.Aggregate(request.Aggregates.SelectMany(a => a.Aggregates));
            
                 var result = new DataSourceResult()
                 {
                     Data = orders,
                     Total = total
                 };
            
                 return Json(result);
             }
              
```

### Where(System.Linq.IQueryable,System.Linq.Expressions.Expression)

Filters a sequence of values based on a predicate.

#### Parameters

##### source - `System.Linq.IQueryable`

An System.Linq.IQueryable to filter.

##### predicate - `System.Linq.Expressions.Expression`

A function to test each element for a condition.

#### RETURNS

An System.Linq.IQueryable that contains elements from the input sequence that satisfy the condition specified by "predicate".

#### Example

```
 
             public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 IQueryable<OrderViewModel> orders = GetOrders();
                 orders.Where(x => x.Freight > 100);
                 var total = orders.Count();
            
                 var result = new DataSourceResult()
                 {
                     Data = orders,
                     Total = total
                 };
            
                 return Json(result);
             }
              
```

### Where(System.Linq.IQueryable,System.Collections.Generic.IEnumerable)

Filters a sequence of values based on a collection of IFilterDescriptor.

#### Parameters

##### source - `System.Linq.IQueryable`

The source.

##### filterDescriptors - System.Collections.Generic.IEnumerable<[IFilterDescriptor](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc/ifilterdescriptor)>

The filter descriptors.

#### RETURNS

An System.Linq.IQueryable that contains elements from the input sequence that satisfy the conditions specified by each filter descriptor in "filterDescriptors".

#### Example

```
 
             public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 IQueryable<OrderViewModel> orders = GetOrders();
                 orders.Where(request.Filters);
                 var total = orders.Count();
            
                 var result = new DataSourceResult()
                 {
                     Data = orders,
                     Total = total
                 };
            
                 return Json(result);
             }
              
```

### Take(System.Linq.IQueryable,System.Int32)

Returns a specified number of contiguous elements from the start of a sequence.

#### Parameters

##### source - `System.Linq.IQueryable`

The sequence to return elements from.

##### count - `System.Int32`

The number of elements to return.

#### RETURNS

An System.Linq.IQueryable that contains the specified number of elements from the start of "source".

#### Example

```
 
             public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 IQueryable<OrderViewModel> orders = GetOrders();
                 orders.Take(1000);
            
                 var result = new DataSourceResult()
                 {
                     Data = orders,
                     Total = 1000
                 };
            
                 return Json(result);
             }
              
```

### Skip(System.Linq.IQueryable,System.Int32)

Bypasses a specified number of elements in a sequence and then returns the remaining elements.

#### Parameters

##### source - `System.Linq.IQueryable`

An System.Linq.IQueryable to return elements from.

##### count - `System.Int32`

The number of elements to skip before returning the remaining elements.

#### RETURNS

An System.Linq.IQueryable that contains elements that occur after the specified index in the input sequence.

#### Example

```
 
             public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 IQueryable<OrderViewModel> orders = GetOrders();
                 var total = orders.Count() - 10;
            
                 orders.Skip(10);
            
                 var result = new DataSourceResult()
                 {
                     Data = orders,
                     Total = total
                 };
            
                 return Json(result);
             }
              
```

### Count(System.Linq.IQueryable)

Returns the number of elements in a sequence.

#### Parameters

##### source - `System.Linq.IQueryable`

The System.Linq.IQueryable that contains the elements to be counted.

#### RETURNS

The number of elements in the input sequence.

#### Example

```
 
             public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 IQueryable<OrderViewModel> orders = GetOrders();
                 var total = orders.Count();
            
                 orders.GroupBy(request.Groups);
            
                 var result = new DataSourceResult()
                 {
                     Data = orders,
                     Total = total
                 };
            
                 return Json(result);
             }
              
```

### ElementAt(System.Linq.IQueryable,System.Int32)

Returns the element at a specified index in a sequence.

#### Parameters

##### source - `System.Linq.IQueryable`

An System.Linq.IQueryable to return an element from.

##### index - `System.Int32`

The zero-based index of the element to retrieve.

#### RETURNS

The element at the specified position in "source".

#### Example

```
 
             public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 IQueryable<OrderViewModel> orders = GetOrders();
                 var total = orders.Count();
            
                 var element = orders.ElementAt(2);
                 element.ContactName = "New Name";
            
                 var result = new DataSourceResult()
                 {
                     Data = orders,
                     Total = total
                 };
            
                 return Json(result);
             }
              
```

### Union(System.Linq.IQueryable,System.Linq.IQueryable)

Produces the set union of two sequences by using the default equality comparer.

#### Parameters

##### source - `System.Linq.IQueryable`

An System.Linq.IQueryable whose distinct elements form the first set for the union.

##### second - `System.Linq.IQueryable`

An System.Linq.IQueryable whose distinct elements form the first set for the union.

#### RETURNS

An System.Linq.IQueryable that contains the elements from both input sequences, excluding duplicates.

#### Example

```
 
             public IActionResult Orders_Read([DataSourceRequest] DataSourceRequest request)
             {
                 IQueryable<OrderViewModel> orders = GetOrders();
                 IQueryable<OrderViewModel> additionalOrders = GetAdditionalOrders();
                 var total = orders.Count();
            
                 orders.Union(additionalOrders);
            
                 var result = new DataSourceResult()
                 {
                     Data = orders,
                     Total = total
                 };
            
                 return Json(result);
             }
              
```

### ToTreeDataSourceResult(System.Collections.IEnumerable,Kendo.Mvc.UI.DataSourceRequest)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.IEnumerable`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult(request);
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Collections.IEnumerable,Kendo.Mvc.UI.DataSourceRequest)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.IEnumerable`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync(request);
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Collections.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.IEnumerable`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                  var result = await GetEmployees(id).ToTreeDataSourceResultAsync(request, token);
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Collections.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.IEnumerable`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult(request, ModelState);
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Collections.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.IEnumerable`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync(request, ModelState);
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Collections.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.IEnumerable`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                  var result = await GetEmployees(id).ToTreeDataSourceResultAsync(request, ModelState, token);
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### selector - `System.Func<TModel,TResult>`

A projection function to apply to each element.

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, Employee>(request, x => new Employee()
                 {
                     EmployeeId = x.EmployeeId
                 });
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### selector - `System.Func<TModel,TResult>`

A projection function to apply to each element.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, Employee>(request, x => new Employee()
                  {
                      EmployeeId = x.EmployeeId
                  });
            
                  return Json(result);
              }
              
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Func,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### selector - `System.Func<TModel,TResult>`

A projection function to apply to each element.

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                  var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, Employee>(request, x => new Employee()
                  {
                      EmployeeId = x.EmployeeId
                  }, token);
            
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### selector - `System.Func<TModel,TResult>`

A projection function to apply to each element.

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, Employee>(request, x => new Employee()
                 {
                     EmployeeId = x.EmployeeId
                 });
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### selector - `System.Func<TModel,TResult>`

A projection function to apply to each element.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, Employee>(request, x => new Employee()
                  {
                      EmployeeId = x.EmployeeId
                  });
            
                  return Json(result);
              }
              
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Func,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### selector - `System.Func<TModel,TResult>`

A projection function to apply to each element.

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                  var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, Employee>(request, x => new Employee()
                  {
                      EmployeeId = x.EmployeeId
                  }, token);
            
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo);
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo);
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, token);
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren);
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren);
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, token);
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, s => new Employee() { EmployeeId = s.EmployeeId });
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, s => new Employee() { EmployeeId = s.EmployeeId });
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Func,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, s => new Employee() { EmployeeId = s.EmployeeId }, token);
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, ModelState);
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, ModelState);
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, ModelState, token);
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, ModelState);
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, ModelState);
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, ModelState, token);
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, s => new Employee() { EmployeeId = s.EmployeeId });
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, s => new Employee() { EmployeeId = s.EmployeeId });
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Func,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, s => new Employee() { EmployeeId = s.EmployeeId }, token);
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, ModelState, s => new Employee() { EmployeeId = s.EmployeeId });
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, ModelState, s => new Employee() { EmployeeId = s.EmployeeId });
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, ModelState, s => new Employee() { EmployeeId = s.EmployeeId }, token);
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, ModelState, s => new Employee() { EmployeeId = s.EmployeeId });
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, ModelState, s => new Employee() { EmployeeId = s.EmployeeId });
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Linq.IQueryable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Linq.IQueryable<TModel>`

An instance of System.Linq.IQueryable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, ModelState, s => new Employee() { EmployeeId = s.EmployeeId }, token);
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo);
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo);
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, token);
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren);
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren);
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, token);
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, s => new Employee() { EmployeeId = s.EmployeeId });
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, s => new Employee() { EmployeeId = s.EmployeeId });
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Func,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, s => new Employee() { EmployeeId = s.EmployeeId }, token);
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, ModelState);
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, ModelState);
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, ModelState, s => new Employee() { EmployeeId = s.EmployeeId }, token);
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, ModelState);
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, ModelState);
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, ModelState, s => new Employee() { EmployeeId = s.EmployeeId }, token);
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, s => new Employee() { EmployeeId = s.EmployeeId });
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, s => new Employee() { EmployeeId = s.EmployeeId });
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Func,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, s => new Employee() { EmployeeId = s.EmployeeId }, token);
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, ModelState, s => new Employee() { EmployeeId = s.EmployeeId });
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, ModelState, s => new Employee() { EmployeeId = s.EmployeeId });
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, ModelState, s => new Employee() { EmployeeId = s.EmployeeId }, token);
                  return Json(result);
              }
              
```

### ToTreeDataSourceResult(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### queryable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

#### RETURNS

A [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied.

#### Example

```
 
            public JsonResult Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
            {
                var result = GetEmployees(id).ToTreeDataSourceResult<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, ModelState, s => new Employee() { EmployeeId = s.EmployeeId });
                return Json(result);
            }
             
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
             public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
             {
                var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, ModelState, s => new Employee() { EmployeeId = s.EmployeeId });
                 return Json(result);
             }
             
```

### ToTreeDataSourceResultAsync(System.Collections.Generic.IEnumerable,Kendo.Mvc.UI.DataSourceRequest,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,System.Linq.Expressions.Expression,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary,System.Func,System.Threading.CancellationToken)

Applies sorting, filtering and grouping using the information from the DataSourceRequest object. If the collection is already paged, the method returns an empty result.

#### Parameters

##### enumerable - `System.Collections.Generic.IEnumerable<TModel>`

An instance of System.Collections.IEnumerable.

##### request - [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest)

An instance of [DataSourceRequest](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/datasourcerequest).

##### idSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the selector of the ID field.

##### parentIDSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the parent selector.

##### rootSelector - `System.Linq.Expressions.Expression<Func>`

The lambda which configures the root selector.

##### modelState - `Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary`

An instance of .

##### selector - `System.Func<TModel,TResult>`

The lambda which configures the selector of the ID field.

##### cancellationToken - `System.Threading.CancellationToken`

An instance of System.Threading.CancellationToken.

#### RETURNS

A Task of [TreeDataSourceResult](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui/treedatasourceresult) object, which contains the processed data after sorting, filtering and grouping are applied. It can be called with the "await" keyword for asynchronous operation.

#### Example

```
 
              public async Task<JsonResult> Employees_Read([DataSourceRequest] DataSourceRequest request, int? id)
              {
                  CancellationTokenSource source = new CancellationTokenSource(2000);
                  CancellationToken token = source.Token;
            
                 var result = await GetEmployees(id).ToTreeDataSourceResultAsync<EmployeeViewModel, int, int?, Employee>(request, x => x.EmployeeId, y => y.ReportsTo, z => z.hasChildren, ModelState, s => new Employee() { EmployeeId = s.EmployeeId }, token);
                  return Json(result);
              }
              
```
