# 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.

#### RETURNS

A [DataSourceWidgetBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/datasourcewidgetbuilder) instance for method chaining.

#### 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](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/ajaxdatasourcebuilder)>

The action that configures the Ajax data binding settings.

#### RETURNS

A [DataSourceWidgetBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/datasourcewidgetbuilder) instance for method chaining.

#### 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](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/webapidatasourcebuilder)>

The action that configures the WebAPI data binding settings.

#### RETURNS

A [DataSourceWidgetBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/datasourcewidgetbuilder) instance for method chaining.

#### 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](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/customdatasourcebuilder)>

The action that configures the custom data binding settings.

#### RETURNS

A [DataSourceWidgetBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/datasourcewidgetbuilder) instance for method chaining.

#### 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](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/signalrdatasourcebuilder)>

The action that configures the SignalR binding settings.

#### RETURNS

A [DataSourceWidgetBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/datasourcewidgetbuilder) instance for method chaining.

#### 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](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/ganttdatasourcebuilder)>

The action that configures the Gantt DataSource settings.

#### RETURNS

A [DataSourceWidgetBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/datasourcewidgetbuilder) instance for method chaining.

#### 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](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/ganttdependenciesdatasourcebuilder)>

The action that configures the DependenciesDataSource settings.

#### RETURNS

A [DataSourceWidgetBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/datasourcewidgetbuilder) instance for method chaining.

#### 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](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/pivotdatasourcebuilder)>

The action that configures the PivotGrid DataSource settings.

#### RETURNS

A [DataSourceWidgetBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/datasourcewidgetbuilder) instance for method chaining.

#### 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](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/hierarchicaldatasourcebuilder)>

The action that configures the Hierarchical DataSource settings.

#### RETURNS

A [DataSourceWidgetBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/datasourcewidgetbuilder) instance for method chaining.

#### Example

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

### TreeList(System.Action)

Configures the DataSource of the TreeList component.

#### Parameters

##### configurator - System.Action<[TreeListAjaxDataSourceBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/treelistajaxdatasourcebuilder)>

The action that configures the TreeList DataSource settings.

#### RETURNS

A [DataSourceWidgetBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/datasourcewidgetbuilder) instance for method chaining.

#### Example

```
 
            @(Html.Kendo().TreeList<TreeListViewModel>()
                .Name("treelist")
                ...
                .DataSource(dataSource => dataSource
                    .Read(read => read.Action("ReadData", "Home"))
                    .Model(m => {
                        m.Id(f => f.EmployeeId);
                        m.ParentId(f => f.ReportsTo);
                    })
                )
            )
             
```

### Scheduler(System.Action)

Configures the DataSource of the Scheduler component.

#### Parameters

##### configurator - System.Action<[SchedulerAjaxDataSourceBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/schedulerajaxdatasourcebuilder)>

The action that configures the Scheduler DataSource settings.

#### RETURNS

A [DataSourceWidgetBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/datasourcewidgetbuilder) instance for method chaining.

#### 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 option should be used in conjunction with Kendo.Mvc.UI.Fluent.WidgetFactory.DeferredScripts(System.Boolean,System.Boolean) method.

#### Parameters

##### deferred - `System.Boolean`

#### RETURNS

Returns a [DeferredDataSourceBuilder](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/deferreddatasourcebuilder) instance.

### Render()

Renders the component in place.
