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

Defines the fluent API for configuring the Telerik UI for ASP.NET Core DataSource

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Type Parameters:

T

Syntax:

C#
public class DataSourceWidgetBuilder<T> : HelperResult, IHtmlContent where T : class

Inheritance: objectHelperResultDataSourceWidgetBuilder<T>

Implements: IHtmlContent

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

Constructors

Gets the view component.

C#
public DataSourceWidgetBuilder(DataSourceWidget<T> component)
Parameters:componentDataSourceWidget<T>

Fields

urlGenerator member.

C#
protected readonly IUrlGenerator urlGenerator

viewContext member.

C#
protected readonly ViewContext viewContext

Properties

Component member.

C#
protected DataSourceWidget<T> Component { get; set; }

Methods

Configures the DataSource for Ajax data binding.

C#
public DataSourceWidgetBuilder<T> Ajax(Action<AjaxDataSourceBuilder<T>> configurator)
Parameters:configuratorAction<AjaxDataSourceBuilder<T>>

The action that configures the Ajax data binding settings.

Returns:

DataSourceWidgetBuilder<T>

A DataSourceWidgetBuilder<T> instance for method chaining.

Example:
C#
@(Html.Kendo().DataSource&lt;ProductViewModel&gt;()
.Name("dataSource1")
.Ajax(dataSource =&gt; dataSource
.PageSize(10)
.Read(read =&gt; read.Action("Read", "Home"))
)
)

Configures a custom DataSource.

C#
public DataSourceWidgetBuilder<T> Custom(Action<CustomDataSourceBuilder<T>> configurator)
Parameters:configuratorAction<CustomDataSourceBuilder<T>>

The action that configures the custom data binding settings.

Returns:

DataSourceWidgetBuilder<T>

A DataSourceWidgetBuilder<T> instance for method chaining.

Example:
C#
@(Html.Kendo().DataSource&lt;ProductViewModel&gt;()
.Name("myDataSource")
.Custom(dataSource =&gt; dataSource
.Type("odata")
.ServerPaging(true)
.PageSize(10)
.Transport(transport =&gt;
{
transport.Read(read =&gt; read.Url("myURL").DataType("jsonp"));
})
)
)

Suppress initialization script rendering. Note that this option should be used in conjunction with DeferredScripts(bool, bool) method.

C#
public virtual DeferredDataSourceBuilder<T> Deferred(bool deferred = true)
Parameters:deferredboolReturns:

DeferredDataSourceBuilder<T>

Returns a DeferredDataSourceBuilder<T> instance.

Configures the DataSource of the Gantt component.

C#
public DataSourceWidgetBuilder<T> Gantt(Action<GanttDataSourceBuilder<T>> configurator)
Parameters:configuratorAction<GanttDataSourceBuilder<T>>

The action that configures the Gantt DataSource settings.

Returns:

DataSourceWidgetBuilder<T>

A DataSourceWidgetBuilder<T> instance for method chaining.

Example:
C#
@(Html.Kendo().Gantt&lt;TaskViewModel, DependencyViewModel&gt;()
.Name("gantt")
...
.DataSource(d =&gt; d
.Model(m =&gt;
{
m.Id(f =&gt; f.TaskID);
m.ParentId(f =&gt; f.ParentID);
})
.Read("ReadTasks", "Gantt")
.Destroy("DestroyTask", "Gantt")
.Update("UpdateTask", "Gantt")
.Create("CreateTask", "Gantt")
)
)

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

C#
public DataSourceWidgetBuilder<T> GanttDependency(Action<GanttDependenciesDataSourceBuilder<T>> configurator)
Parameters:configuratorAction<GanttDependenciesDataSourceBuilder<T>>

The action that configures the DependenciesDataSource settings.

Returns:

DataSourceWidgetBuilder<T>

A DataSourceWidgetBuilder<T> instance for method chaining.

Example:
C#
@(Html.Kendo().Gantt&lt;TaskViewModel, DependencyViewModel&gt;()
.Name("gantt")
...
.DependenciesDataSource(d =&gt; d
.Model(m =&gt;
{
m.Id(f =&gt; f.DependencyID);
m.PredecessorId(f =&gt; f.PredecessorID);
m.SuccessorId(f =&gt; f.SuccessorID);
})
.Read("ReadDependencies", "Gantt")
.Create("CreateDependency", "Gantt")
.Destroy("DestroyDependency", "Gantt")
)
)

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

C#
public DataSourceWidgetBuilder<T> Hierarchical(Action<HierarchicalDataSourceBuilder<T>> configurator)
Parameters:configuratorAction<HierarchicalDataSourceBuilder<T>>

The action that configures the Hierarchical DataSource settings.

Returns:

DataSourceWidgetBuilder<T>

A DataSourceWidgetBuilder<T> instance for method chaining.

Example:
C#
@(Html.Kendo().TreeView()
.Name("treeview")
.DataTextField("Name")
.DataSource(dataSource =&gt; dataSource
.Read(read =&gt; read
.Action("Read", "TreeView")
)
)
)

Sets the name of the component.

C#
public virtual DataSourceWidgetBuilder<T> Name(string componentName)
Parameters:componentNamestring

The string value that configures the name option.

Returns:

DataSourceWidgetBuilder<T>

A DataSourceWidgetBuilder<T> instance for method chaining.

Example:
C#
@(Html.Kendo().DataSource&lt;ProductViewModel&gt;()
.Name("dataSource1")
.Ajax(dataSource =&gt; dataSource
.PageSize(10)
.Read(read =&gt; read.Action("Read", "Home"))
)
)

Configures the DataSource of the PivotGrid component.

C#
public DataSourceWidgetBuilder<T> Pivot(Action<PivotDataSourceBuilder<T>> configurator)
Parameters:configuratorAction<PivotDataSourceBuilder<T>>

The action that configures the PivotGrid DataSource settings.

Returns:

DataSourceWidgetBuilder<T>

A DataSourceWidgetBuilder<T> instance for method chaining.

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

Renders the component in place.

C#
public virtual void Render()

Configures the DataSource of the Scheduler component.

C#
public DataSourceWidgetBuilder<T> Scheduler(Action<SchedulerAjaxDataSourceBuilder<T>> configurator)
Parameters:configuratorAction<SchedulerAjaxDataSourceBuilder<T>>

The action that configures the Scheduler DataSource settings.

Returns:

DataSourceWidgetBuilder<T>

A DataSourceWidgetBuilder<T> instance for method chaining.

Example:
C#
@(Html.Kendo().Scheduler&lt;TaskViewModel&gt;()
.Name("scheduler")
...
.DataSource(d =&gt; d
.Model(m =&gt;
{
m.Id(f =&gt; f.TaskID);
})
.Read("Read", "Scheduler")
.Create("Create", "Scheduler")
.Destroy("Destroy", "Scheduler")
.Update("Update", "Scheduler")
)
)

Configures the DataSource SignalR binding.

C#
public DataSourceWidgetBuilder<T> SignalR(Action<SignalRDataSourceBuilder<T>> configurator)
Parameters:configuratorAction<SignalRDataSourceBuilder<T>>

The action that configures the SignalR binding settings.

Returns:

DataSourceWidgetBuilder<T>

A DataSourceWidgetBuilder<T> instance for method chaining.

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

Configures the DataSource of the TreeList component.

C#
public DataSourceWidgetBuilder<T> TreeList(Action<TreeListAjaxDataSourceBuilder<T>> configurator)
Parameters:configuratorAction<TreeListAjaxDataSourceBuilder<T>>

The action that configures the TreeList DataSource settings.

Returns:

DataSourceWidgetBuilder<T>

A DataSourceWidgetBuilder<T> instance for method chaining.

Example:
C#
@(Html.Kendo().TreeList&lt;TreeListViewModel&gt;()
.Name("treelist")
...
.DataSource(dataSource =&gt; dataSource
.Read(read =&gt; read.Action("ReadData", "Home"))
.Model(m =&gt; {
m.Id(f =&gt; f.EmployeeId);
m.ParentId(f =&gt; f.ReportsTo);
})
)
)

Configures the DataSource for WebAPI data binding.

C#
public DataSourceWidgetBuilder<T> WebApi(Action<WebApiDataSourceBuilder<T>> configurator)
Parameters:configuratorAction<WebApiDataSourceBuilder<T>>

The action that configures the WebAPI data binding settings.

Returns:

DataSourceWidgetBuilder<T>

A DataSourceWidgetBuilder<T> instance for method chaining.

Example:
C#
@(Html.Kendo().DataSource&lt;ProductViewModel&gt;()
.Name("myDataSource")
.WebApi(dataSource =&gt; dataSource
.PageSize(10)
.Read(read =&gt; read.Action("Get", "Home"))
)
)
C#
public override void WriteTo(TextWriter writer, HtmlEncoder encoder)
Parameters:writerTextWriterencoderHtmlEncoder

Overrides: HelperResult.WriteTo(TextWriter, HtmlEncoder)