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

AjaxDataSourceBuilder

Defines the fluent interface for configuring the DataSource AJAX create/update/destroy operation bindings.

Methods

Update(System.Action)

Configures the URL for Update operation.

Parameters

configurator - System.Action<CrudOperationBuilder>

The lambda which configures the Update Action

Example


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

Update(System.String,System.String)

Sets controller and action for Update operation.

Parameters

actionName - System.String

Action name

controllerName - System.String

Controller Name

Example


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

Update(System.String,System.String,System.Object)

Sets controller, action and routeValues for Update operation.

Parameters

actionName - System.String

Action name

controllerName - System.String

Controller Name

routeValues - System.Object

Route values

Example


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

Create(System.Action)

Configures the URL for Create operation.

Parameters

configurator - System.Action<CrudOperationBuilder>

The lambda which configures the Create Action

Example


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

Create(System.String,System.String)

Sets controller and action for Create operation.

Parameters

actionName - System.String

Action name

controllerName - System.String

Controller Name

Example


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

Create(System.String,System.String,System.Object)

Sets controller, action and routeValues for Create operation.

Parameters

actionName - System.String

Action name

controllerName - System.String

Controller Name

routeValues - System.Object

Route values

Example


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

Destroy(System.Action)

Configures the URL for Destroy operation.

Parameters

configurator - System.Action<CrudOperationBuilder>

The lambda which configures the Destroy Action

Example


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

Destroy(System.String,System.String)

Sets controller and action for Destroy operation.

Parameters

actionName - System.String

Action name

controllerName - System.String

Controller Name

Example


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

Destroy(System.String,System.String,System.Object)

Sets controller, action and routeValues for Destroy operation.

Parameters

actionName - System.String

Action name

controllerName - System.String

Controller Name

routeValues - System.Object

Route values

Example


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

Batch(System.Boolean)

Determines if modifications will be sent to the server in batches or as individually requests.

Parameters

enabled - System.Boolean

If true changes will be batched, otherwise false.

Example


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

AutoSync(System.Boolean)

Determines if data source would automatically sync any changes to its data items. By default changes are not automatically sync-ed.

Parameters

enabled - System.Boolean

If true changes will be automatically synced, otherwise false.

Example


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

StringifyDates(System.Boolean)

Determines if dates should be formatted before submitted to the server.

Parameters

enabled - System.Boolean

If true dates will be sent not formatted.

Example


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

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)
            )

OfflineStorage(System.String)

Sets the key used for offline state persistance.

Parameters

key - System.String

Example


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

AccentFoldingFiltering(System.String)

Configures whether diacritic filtering should be used.

Parameters

culture - System.String

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)
            )

GroupPaging(System.Boolean)

Enables/disables group paging.

Parameters

enabled - System.Boolean

Example


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

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))
            )

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))
            )

In this article
Not finding the help you need?