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

ServerDataSourceBuilder

Methods

Read(System.Action)

Configures the URL for Read operation.

Parameters

configurator - System.Action<ServerCrudOperationBuilder>

Example


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                            .Read(r=>r.Route(new RouteValueDictionary() ))
                        )
                    )

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


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                            .Read("Action","Controller", new { }))
                        )
                    )

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


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                            .Read("Action","Controller"))
                        )
                    )

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


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                             .Total(50)
                        )
                    )

Update(System.Action)

Configures the URL for Update operation.

Parameters

configurator - System.Action<ServerCrudOperationBuilder>

The configurator of the URL for the Update operation.

Example


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                             .Update(u=>u.Url("url"))
                        )
                    )

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

Sets controller and action for Update operation.

Parameters

actionName - System.String

Action name

controllerName - System.String

Controller Name

routeValues - System.Object

Route values

Example


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                              .Update("Action", "Controller", new { })
                        )
                    )

Update(System.String,System.String)

Sets controller, action and routeValues for Update operation.

Parameters

actionName - System.String

Action name

controllerName - System.String

Controller Name

Example


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                              .Update("Action", "Controller")
                        )
                    )

Create(System.Action)

Configures the URL for Create operation.

Parameters

configurator - System.Action<ServerCrudOperationBuilder>

The configurator of the URL for the Create operation.

Example


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                             .Create(u=>u.Url("url"))
                        )
                    )

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

Sets controller and action for Create operation.

Parameters

actionName - System.String

Action name

controllerName - System.String

Controller Name

routeValues - System.Object

Route values

Example


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                              .Create("Action", "Controller", new { })
                        )
                    )

Create(System.String,System.String)

Sets controller, action and routeValues for Create operation.

Parameters

actionName - System.String

Action name

controllerName - System.String

Controller Name

Example


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                              .Create("Action", "Controller")
                        )
                    )

Destroy(System.Action)

Configures the URL for Destroy operation.

Parameters

configurator - System.Action<ServerCrudOperationBuilder>

The configurator of the URL for the Destroy operation.

Example


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                             .Destroy(u=>u.Url("url"))
                        )
                    )

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

Sets controller and action for Destroy operation.

Parameters

actionName - System.String

Action name

controllerName - System.String

Controller Name

routeValues - System.Object

Route values

Example


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                              .Destroy("Action", "Controller", new { })
                        )
                    )

Destroy(System.String,System.String)

Sets controller, action and routeValues for Destroy operation.

Parameters

actionName - System.String

Action name

controllerName - System.String

Controller Name

Example


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                              .Destroy("Action", "Controller")
                        )
                    )

PageSize(System.Int32)

Sets the number of records displayed on a single page.

Parameters

pageSize - System.Int32

Count of records per page.

Example


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                              .PageSize(10)
                        )
                    )

Sort(System.Action)

Configures the initial sorting.

Parameters

configurator - System.Action<DataSourceSortDescriptorFactory>

The applied sorting configuration.

Example


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                              .Sort(s=>s.Add(x=>x.ContactName).Ascending())
                        )
                    )

Group(System.Action)

Configures the initial grouping.

Parameters

configurator - System.Action<DataSourceGroupDescriptorFactory>

The applied grouping configuration.

Example


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                             .Group(s=>s.Add(x=>x.ContactName))
                        )
                    )

Aggregates(System.Action)

Configures the initial aggregates.

Parameters

aggregates - System.Action<DataSourceAggregateDescriptorFactory>

Example


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                             .Aggregates(s=>s.Add(x=>x.ContactName).Count())
                        )
                    )

Filter(System.Action)

Configures the initial filter.

Parameters

configurator - System.Action<DataSourceFilterDescriptorFactory>

The applied Filter configuration.

Example


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                             .Filter(f=>f.Add(x=>x.ContactName).Contains("Test"))
                        )
                    )

Model(System.Action)

Configures Model properties

Parameters

configurator - System.Action<DataSourceModelDescriptorFactory>

The model configurator.

Example


                   @(Html.Kendo().Grid<OrderViewModel>()
                        .Columns(c=> {
                            c.Bound(b => b.OrderID);
                            c.Bound(b => b.OrderDate);
                        })
                        .Name("grid")
                        .DataSource(ds=> ds
                            .Ajax()
                             .Model(f=>f.Id(s=>s.OrderID))
                        )
                    )

In this article
Not finding the help you need?