DataSourceWidgetBuilder
Methods
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")
)
)
ToComponent()
Returns the internal view component.
Name(System.String)
Sets the name of the component.
Parameters
componentName - System.String
The name of the component.
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Deferred(System.Boolean)
Suppress initialization script rendering. Note that this options should be used in conjunction with
Parameters
deferred - System.Boolean
ModelMetadata(System.Web.Mvc.ModelMetadata)
Uses the Metadata of the Model.
Parameters
modelMetadata - System.Web.Mvc.ModelMetadata
The metadata set for the Model
HtmlAttributes(System.Object)
Sets the HTML attributes.
Parameters
attributes - System.Object
The HTML attributes.
HtmlAttributes(System.Collections.Generic.IDictionary)
Parameters
attributes - System.Collections.Generic.IDictionary<String,Object>
AsModule(System.Boolean)
Specifies whether the initialization script of the component will be rendered as a JavaScript module.
Parameters
value - System.Boolean
Render()
Renders the component.
Example
@(@Page Inherits="System.Web.Mvc.ViewPage<IEnumerable<Product>>" )
@( Html.Kendo().Grid(Model)
.Name("grid")
.DetailTemplate(product => {
)
Product Details:
<div>Product Name: @( product.ProductName )</div>
<div>Units In Stock: @( product.UnitsInStock )</div>
@(
})
.Render();
)
ScriptAttributes(System.Object,System.Boolean)
Sets the JavaScript attributes to the initialization script.
Parameters
attributes - System.Object
The JavaScript attributes.
overrideAttributes - System.Boolean
Argument which determines whether attributes should be overriden.
ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)
Sets the JavaScript attributes to the initialization script.
Parameters
attributes - System.Collections.Generic.IDictionary<String,Object>
The JavaScript attributes.
overrideAttributes - System.Boolean
Argument which determines whether attributes should be overriden.