New to Telerik UI for ASP.NET MVC? Download free 30-day trial

AjaxDataSourceBuilderBase

Methods

Events(System.Action)

Configures the client-side events

Parameters

configurator - System.Action<DataSourceEventBuilder>

The lambda which configures the Update Action

Example


            .DataSource(dataSource => dataSource
                .Ajax()
                .Events(e => e.Push("onDataSourcePush"))
            )

Read(System.Action)

Configures the URL for Read operation.

Parameters

configurator - System.Action<CrudOperationBuilder>

The lambda which configures the Read Action

Example


            .DataSource(dataSource => dataSource
                .Ajax()
                .Read(u => u.Action("Read", "Grid"))
            )

Read(System.String,System.String,System.Object)

Sets controller and action for Read operation.

Parameters

actionName - System.String

Action name

controllerName - System.String

Controller Name

routeValues - System.Object

Route values

Example


            .DataSource(dataSource => dataSource
                .Ajax()
                .Read("Read", "Grid", new { id = ViewData["id"] })
            )

Read(System.String,System.String)

Sets controller, action and routeValues for Read operation.

Parameters

actionName - System.String

Action name

controllerName - System.String

Controller Name

Example


            .DataSource(dataSource => dataSource
                .Ajax()
                .Read("Read", "Grid")
            )

Total(System.Int32)

Sets the total number of records in the data source. Required during Custom binding.

Parameters

total - System.Int32

Number of records

Example


            .DataSource(dataSource => dataSource
                .Ajax()
                .Total(50)
            )

GroupPaging(System.Boolean)

Enables/disables group paging.

Parameters

enabled - System.Boolean

Example


            .DataSource(dataSource => dataSource
                .Ajax()
                .GroupPaging(true)
            )

OfflineStorage(System.String)

Sets the key used for offline state persistance.

Parameters

key - System.String

Example


            .DataSource(dataSource => dataSource
                .Ajax()
                .OfflineStorage("products-offline")
            )

OfflineStorage(System.String,System.String)

Specifies custom implementation for offline storage.

Parameters

getItem - System.String

The name of the JavaScript function which returns the offline state.

setItem - System.String

The name of the JavaScript function which saves the offline state.

Example


            .DataSource(dataSource => dataSource
                .Ajax()
                .OfflineStorage("getItem", "setItem")
            )

PageSize(System.Int32)

Sets the number of records displayed on a single page.

Parameters

pageSize - System.Int32

An integer value for the size of a Page in the DataSource

Example


            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(20)
            )

ServerOperation(System.Boolean)

Sets the operation mode of the DataSource. By default the DataSource will make a request to the server when data for paging, sorting, filtering or grouping is needed. If set to false all data will be requested through single request. Any other paging, sorting, filtering or grouping will be performed client-side.

Parameters

enabled - System.Boolean

True(default) if server operation mode is enabled, otherwise false.

Example


            .DataSource(dataSource => dataSource
                .Ajax()
                .ServerOperation(false)
            )

Sort(System.Action)

Configures the initial sorting.

Parameters

configurator - System.Action<DataSourceSortDescriptorFactory>

The lambda which configures the Sort Action

Example


            .DataSource(dataSource => dataSource
                .Ajax()
                .Sort(s => s.Add("ShipName"))
            )

Group(System.Action)

Configures the initial grouping.

Parameters

configurator - System.Action<DataSourceGroupDescriptorFactory>

The lambda which configures the Group Action

Example


            .DataSource(dataSource => dataSource
                .Ajax()
                .Group(g => g.Add(a => a.ShipName))
            )

AccentFoldingFiltering(System.String)

Configures whether diacritic filtering should be used.

Parameters

culture - System.String

The culture applied for the Action

Example


            .DataSource(dataSource => dataSource
                .Ajax()
                .AccentFoldingFiltering("bg-BG")
            )

Aggregates(System.Action)

Configures the initial aggregates.

Parameters

aggregates - System.Action<DataSourceAggregateDescriptorFactory>

The Aggregates set for the DataSource

Example


            .DataSource(dataSource => dataSource
                .Ajax()
                        .Aggregates(aggregates =>
                        {
                            aggregates.Add(p => p.UnitsInStock).Min().Max().Count();
                            aggregates.Add(p => p.UnitsOnOrder).Average();
                            aggregates.Add(p => p.ProductName).Count();
                            aggregates.Add(p => p.UnitPrice).Sum();
                        })
            )

Filter(System.Action)

Configures the initial filter.

Parameters

configurator - System.Action<DataSourceFilterDescriptorFactory>

The lambda which configures the Filter Action

Example


            .DataSource(dataSource => dataSource
                .Ajax()
                .Filter(f => f.Add(a => a.ShipName))
            )

Model(System.Action)

Configures Model properties

Parameters

configurator - System.Action<DataSourceModelDescriptorFactory>

The lambda which configures the Model instance

Example


            .DataSource(dataSource => dataSource
                .Ajax()
                .Model(m => m.Id(o => o.OrderID))
            )

CaseSensitiveFiltering()

When enabled filtering is case sensitive

Example


            .DataSource(dataSource => dataSource
                .Ajax()
                .CaseSensitiveFiltering()
            )

In this article
Not finding the help you need?