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

Defines the fluent interface for configuring the DataSource options.

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Type Parameters:

TModel

TDataSourceBuilder

Syntax:

C#
public abstract class AjaxDataSourceBuilderBase<TModel, TDataSourceBuilder> where TModel : class where TDataSourceBuilder : AjaxDataSourceBuilderBase<TModel, TDataSourceBuilder>

Inheritance: objectAjaxDataSourceBuilderBase<TModel, TDataSourceBuilder>

Derived Classes: AjaxDataSourceBuilder<TModel>FilterableAjaxDataSourceBuilder<TModel, TDataSourceBuilder>OrgChartAjaxDataSourceBuilder<TModel>ReadOnlyAjaxDataSourceBuilder<TModel>

Inherited Members object.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

C#
public AjaxDataSourceBuilderBase(DataSource dataSource, ViewContext viewContext, IUrlGenerator urlGenerator)
Parameters:dataSourceDataSourceviewContextViewContexturlGeneratorIUrlGenerator

Fields

C#
protected readonly DataSource dataSource
C#
protected readonly IUrlGenerator urlGenerator

viewContext

ViewContext

C#
protected readonly ViewContext viewContext

Methods

Configures whether diacritic filtering should be used.

C#
public virtual TDataSourceBuilder AccentFoldingFiltering(string culture)
Parameters:culturestring

The culture applied for the Action

Returns:

TDataSourceBuilder

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.AccentFoldingFiltering("bg-BG")
)

Configures the initial aggregates.

C#
public virtual TDataSourceBuilder Aggregates(Action<DataSourceAggregateDescriptorFactory<TModel>> aggregates)
Parameters:aggregatesAction<DataSourceAggregateDescriptorFactory<TModel>>

The Aggregates set for the DataSource

Returns:

TDataSourceBuilder

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.Aggregates(aggregates =&gt;
{
aggregates.Add(p =&gt; p.UnitsInStock).Min().Max().Count();
aggregates.Add(p =&gt; p.UnitsOnOrder).Average();
aggregates.Add(p =&gt; p.ProductName).Count();
aggregates.Add(p =&gt; p.UnitPrice).Sum();
})
)

When enabled filtering is case sensitive

C#
public virtual TDataSourceBuilder CaseSensitiveFiltering()
Returns:

TDataSourceBuilder

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.CaseSensitiveFiltering()
)

Configures the client-side events

C#
public TDataSourceBuilder Events(Action<DataSourceEventBuilder> configurator)
Parameters:configuratorAction<DataSourceEventBuilder>

The lambda which configures the Update Action

Returns:

TDataSourceBuilder

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.Events(e =&gt; e.Push("onDataSourcePush"))
)

Configures the initial filter.

C#
public virtual TDataSourceBuilder Filter(Action<DataSourceFilterDescriptorFactory<TModel>> configurator)
Parameters:configuratorAction<DataSourceFilterDescriptorFactory<TModel>>

The lambda which configures the Filter Action

Returns:

TDataSourceBuilder

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.Filter(f =&gt; f.Add(a =&gt; a.ShipName))
)

Configures the initial grouping.

C#
public virtual TDataSourceBuilder Group(Action<DataSourceGroupDescriptorFactory<TModel>> configurator)
Parameters:configuratorAction<DataSourceGroupDescriptorFactory<TModel>>

The lambda which configures the Group Action

Returns:

TDataSourceBuilder

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.Group(g =&gt; g.Add(a =&gt; a.ShipName))
)

Enables/disables group paging.

C#
public TDataSourceBuilder GroupPaging(bool enabled)
Parameters:enabledboolReturns:

TDataSourceBuilder

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.GroupPaging(true)
)

Configures Model properties

C#
public virtual TDataSourceBuilder Model(Action<DataSourceModelDescriptorFactory<TModel>> configurator)
Parameters:configuratorAction<DataSourceModelDescriptorFactory<TModel>>

The lambda which configures the Model instance

Returns:

TDataSourceBuilder

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.Model(m =&gt; m.Id(o =&gt; o.OrderID))
)

Specifies custom implementation for offline storage.

C#
public TDataSourceBuilder OfflineStorage(string getItem, string setItem)
Parameters:getItemstring

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

setItemstring

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

Returns:

TDataSourceBuilder

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.OfflineStorage("getItem", "setItem")
)

Sets the key used for offline state persistance.

C#
public TDataSourceBuilder OfflineStorage(string key)
Parameters:keystringReturns:

TDataSourceBuilder

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.OfflineStorage("products-offline")
)

Sets the number of records displayed on a single page.

C#
public TDataSourceBuilder PageSize(int pageSize)
Parameters:pageSizeint

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

Returns:

TDataSourceBuilder

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.PageSize(20)
)

Configures the URL for Read operation.

C#
public TDataSourceBuilder Read(Action<CrudOperationBuilder> configurator)
Parameters:configuratorAction<CrudOperationBuilder>

The lambda which configures the Read Action

Returns:

TDataSourceBuilder

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.Read(u =&gt; u.Action("Read", "Grid"))
)

Sets controller and action for Read operation.

C#
public TDataSourceBuilder Read(string actionName, string controllerName, object routeValues)
Parameters:actionNamestring

Action name

controllerNamestring

Controller Name

routeValuesobject

Route values

Returns:

TDataSourceBuilder

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.Read("Read", "Grid", new { id = ViewData["id"] })
)

Sets controller, action and routeValues for Read operation.

C#
public TDataSourceBuilder Read(string actionName, string controllerName)
Parameters:actionNamestring

Action name

controllerNamestring

Controller Name

Returns:

TDataSourceBuilder

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.Read("Read", "Grid")
)

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.

C#
public TDataSourceBuilder ServerOperation(bool enabled)
Parameters:enabledbool

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

Returns:

TDataSourceBuilder

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.ServerOperation(false)
)

Configures the OperationUrl

C#
protected virtual void SetOperationUrl(CrudOperation operation, string actionName, string controllerName, object routeValues)
Parameters:operationCrudOperation

The CRUD operation

actionNamestring

The name of the Action

controllerNamestring

The name of the Controller

routeValuesobject

The root values for the Action

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.SetOperationUrl(CrudOperation.Equals, "Operation", "Grid", new { id = ViewData["id"] })
)

Configures the initial sorting.

C#
public virtual TDataSourceBuilder Sort(Action<DataSourceSortDescriptorFactory<TModel>> configurator)
Parameters:configuratorAction<DataSourceSortDescriptorFactory<TModel>>

The lambda which configures the Sort Action

Returns:

TDataSourceBuilder

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.Sort(s =&gt; s.Add("ShipName"))
)

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

C#
public TDataSourceBuilder Total(int total)
Parameters:totalint

Number of records

Returns:

TDataSourceBuilder

Example:
C#
.DataSource(dataSource =&gt; dataSource
.Ajax()
.Total(50)
)