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

DataSourceWidgetBuilder

Properties

WriteAction - Func

Methods

Name(System.String)

Sets the name of the component.

Parameters

componentName - System.String

The string value that configures the name option.

Example


                @(Html.Kendo().DataSource<ProductViewModel>()
                   .Name("dataSource1")
                   .Ajax(dataSource => dataSource
                     .PageSize(10)
                     .Read(read => read.Action("Read", "Home"))
                   )
                )

WriteTo(System.IO.TextWriter,System.Text.Encodings.Web.HtmlEncoder)

Parameters

writer - System.IO.TextWriter
encoder - System.Text.Encodings.Web.HtmlEncoder

Ajax(System.Action)

Configures the DataSource for Ajax data binding.

Parameters

configurator - System.Action<AjaxDataSourceBuilder>

The action that configures the Ajax data binding settings.

Example


                @(Html.Kendo().DataSource<ProductViewModel>()
                   .Name("dataSource1")
                   .Ajax(dataSource => dataSource
                     .PageSize(10)
                     .Read(read => read.Action("Read", "Home"))
                   )
                )

WebApi(System.Action)

Configures the DataSource for WebAPI data binding.

Parameters

configurator - System.Action<WebApiDataSourceBuilder>

The action that configures the WebAPI data binding settings.

Example


                @(Html.Kendo().DataSource<ProductViewModel>()
                   .Name("myDataSource")
                   .WebApi(dataSource => dataSource
                     .PageSize(10)
                     .Read(read => read.Action("Get", "Home"))
                   )
                )

Custom(System.Action)

Configures a custom DataSource.

Parameters

configurator - System.Action<CustomDataSourceBuilder>

The action that configures the custom data binding settings.

Example


                @(Html.Kendo().DataSource<ProductViewModel>()
                   .Name("myDataSource")
                   .Custom(dataSource => dataSource
                     .Type("odata")
                     .ServerPaging(true)
                     .PageSize(10)
                     .Transport(transport =>
                     {
                        transport.Read(read => read.Url("myURL").DataType("jsonp"));
                     })
                   )
                )

SignalR(System.Action)

Configures the DataSource SignalR binding.

Parameters

configurator - System.Action<SignalRDataSourceBuilder>

The action that configures the SignalR binding settings.

Example


            @(Html.Kendo().Grid<ProductViewModel>()
                .Name("grid")
                ...
                .DataSource(dataSource => dataSource
                    .SignalR()
                    .PageSize(20)
                    .Transport(tr => tr
                        .Promise("hubStart")
                        .Hub("hub")
                        .Client(c => c
                            .Read("read")
                            .Create("create")
                            .Update("update")
                            .Destroy("destroy"))
                        .Server(s => s
                            .Read("read")
                            .Create("create")
                            .Update("update")
                            .Destroy("destroy")))
                    .Schema(schema => schema
                        .Model(model =>
                        {
                            model.Id("ID");
                            model.Field("ID", typeof(int)).Editable(false);
                        }))
                )
              )

Gantt(System.Action)

Configures the DataSource of the Gantt component.

Parameters

configurator - System.Action<GanttDataSourceBuilder>

The action that configures the Gantt DataSource settings.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
               .Name("gantt")
               ...
               .DataSource(d => d
                   .Model(m =>
                   {
                       m.Id(f => f.TaskID);
                       m.ParentId(f => f.ParentID);
                   })
                   .Read("ReadTasks", "Gantt")
                   .Destroy("DestroyTask", "Gantt")
                   .Update("UpdateTask", "Gantt")
                   .Create("CreateTask", "Gantt")
               )
            )

GanttDependency(System.Action)

Configures the DataSource for the dependencies of the Gantt component tasks.

Parameters

configurator - System.Action<GanttDependenciesDataSourceBuilder>

The action that configures the DependenciesDataSource settings.

Example


             @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
               .Name("gantt")
               ...
               .DependenciesDataSource(d => d
                   .Model(m =>
                   {
                       m.Id(f => f.DependencyID);
                       m.PredecessorId(f => f.PredecessorID);
                       m.SuccessorId(f => f.SuccessorID);
                   })
                   .Read("ReadDependencies", "Gantt")
                   .Create("CreateDependency", "Gantt")
                   .Destroy("DestroyDependency", "Gantt")
               )
             )

Pivot(System.Action)

Configures the DataSource of the PivotGrid component.

Parameters

configurator - System.Action<PivotDataSourceBuilder>

The action that configures the PivotGrid DataSource settings.

Example


            @(Html.Kendo().PivotGrid<CustomerViewModel>()
               .Name("pivotgrid")
               ...
               .DataSource(dataSource => dataSource
                   .Ajax()
                   .Transport(transport => transport.Read("ReadData", "PivotGrid"))
                   .Schema(schema => schema
                       .Cube(cube => cube
                           .Dimensions(dimensions => {
                               dimensions.Add(model => model.ContactName).Caption("All Contacts");
                               dimensions.Add(model => model.CompanyName).Caption("All Companies");
                           })
                           .Measures(measures => measures.Add("Contacts Count").Field(model => model.CustomerID).AggregateName("count"))
                       ))
                   .Columns(columns =>
                   {
                       columns.Add("Country").Expand(false);
                       columns.Add("CompanyName");
                   })
                   .Rows(rows => rows.Add("ContactTitle").Expand(false))
                   .Measures(measures => measures.Values("Contacts Count"))
               )
            )

Hierarchical(System.Action)

Configures the Hierarchical DataSource that allows the representation of hierarchical data.

Parameters

configurator - System.Action<HierarchicalDataSourceBuilder>

The action that configures the Hierarchical DataSource settings.

Example


            @(Html.Kendo().TreeView()
                .Name("treeview")
                .DataTextField("Name")
                .DataSource(dataSource => dataSource
                    .Read(read => read
                        .Action("Read", "TreeView")
                    )
                )
            )

TreeList(System.Action)

Parameters

configurator - System.Action<TreeListAjaxDataSourceBuilder>

Scheduler(System.Action)

Configures the DataSource of the Scheduler component.

Parameters

configurator - System.Action<SchedulerAjaxDataSourceBuilder>

The action that configures the Scheduler DataSource settings.

Example


            @(Html.Kendo().Scheduler<TaskViewModel>()
                .Name("scheduler")
                ...
                .DataSource(d => d
                    .Model(m =>
                    {
                        m.Id(f => f.TaskID);
                    })
                    .Read("Read", "Scheduler")
                    .Create("Create", "Scheduler")
                    .Destroy("Destroy", "Scheduler")
                    .Update("Update", "Scheduler")
                )
            )

Deferred(System.Boolean)

Suppress initialization script rendering. Note that this options should be used in conjunction with

Parameters

deferred - System.Boolean

Render()

Renders the component in place.

In this article
Not finding the help you need?