Kendo.Mvc.UI.Fluent.ListViewBuilder

Defines the fluent API for configuring the Kendo UI ListView

Methods

DataSource(System.Action<Kendo.Mvc.UI.Fluent.DataSourceBuilder<T>>)

Binds the ListView to a DataSource.

Parameters

configurator System.Action<Kendo.Mvc.UI.Fluent.DataSourceBuilder>

The 1 configurator.

Example (ASPX)

@(Html.Kendo().ListView<ProductViewModel>()
    .Name("productsLitView")
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("Products_Read", "ListView"))
        .PageSize(21)
    )
)

BindTo(System.Collections.Generic.IEnumerable<T>)

Binds the ListView to a list of objects

Parameters

dataSource System.Collections.Generic.IEnumerable<T>

The IEnumerable list of objects.

Example (ASPX)

@(Html.Kendo().ListView<ProductViewModel>()
    .Name("productsLitView")
    .BindTo((IEnumerable<ProductViewModel>) ViewData["Products"]);
)

DataSource(System.String)

Binds the ListView to an existing DataSource instance.

Parameters

dataSourceId System.String

The name of the client DataSource instance.

Returns

Example (ASPX)

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

BindTo(System.Collections.IEnumerable)

Binds the ListView to a list of objects

Parameters

dataSource System.Collections.IEnumerable

The data source.

Example (ASPX)

@(Html.Kendo().ListView<ProductViewModel>()
    .Name("productsLitView")
    .BindTo((IEnumerable<ProductViewModel>) ViewData["Products"]);
)

ClientTemplateId(System.String)

Specifies ListView item template.

Parameters

templateId System.String

The Id of the element which contains the template.

Example (ASPX)

@(Html.Kendo().DataSource<ProductViewModel>()
    .Name("productsListView")
    .ClientTemplateId("listViewTemplate");
)

ClientAltTemplateId(System.String)

Specifies ListView alternating item template.

Parameters

templateId System.String

The Id of the element which contains the template.

Example (ASPX)

@(Html.Kendo().DataSource<ProductViewModel>()
    .Name("productsListView")
    .ClientAltTemplateId("listViewTemplate");
)

Pageable

Allows paging of the data.

Example (ASPX)

@(Html.Kendo().ListView<ProductViewModel>()
    .Name("productsLitView")
    .Pageable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("Products_Read", "ListView"))
        .PageSize(21)
    )
)

Pageable(System.Action<Kendo.Mvc.UI.Fluent.PageableBuilder>)

Allows paging of the data.

Parameters

pagerAction System.Action<Kendo.Mvc.UI.Fluent.PageableBuilder>

Use builder to define paging settings.

Example (ASPX)

@(Html.Kendo().ListView<ProductViewModel>()
    .Name("productsLitView")
    .Pageable(paging=>paging.Numeric(true).PreviousNext(true).PageSizes(false))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("Products_Read", "ListView"))
        .PageSize(21)
    )
)

Selectable(Kendo.Mvc.UI.ListViewSelectionMode)

Enables selection in the specified selection mode.

Parameters

mode Kendo.Mvc.UI.ListViewSelectionMode

The selection mode.

Example (ASPX)

@(Html.Kendo().ListView<ProductViewModel>()
    .Name("productsLitView")
    .Selectable(select=>select.Mode(ListViewSelectionMode.Multiple))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("Products_Read", "ListView"))
        .PageSize(21)
    )
)

Selectable

Enables single item selection.

Example (ASPX)

@(Html.Kendo().ListView<ProductViewModel>()
    .Name("productsLitView")
    .Selectable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("Products_Read", "ListView"))
        .PageSize(21)
    )
)

Editable(System.Action<Kendo.Mvc.UI.Fluent.ListViewEditingSettingsBuilder<T>>)

Configures the ListView editing settings.

Parameters

configurator System.Action<Kendo.Mvc.UI.Fluent.ListViewEditingSettingsBuilder>

The editing settings configurator.

Example (ASPX)

@(Html.Kendo().ListView<ProductViewModel>()
    .Name("productsLitView")
    .Editable(edit => edit.Enabled(true))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model => model.Id("ProductID"))
        .Read(read => read.Action("Products_Read", "ListView"))
        .Update(update => update.Action("Products_Update", "ListView"))
        .PageSize(21)
    )
)

Editable

Enables ListView editing.

Example (ASPX)

@(Html.Kendo().ListView<ProductViewModel>()
    .Name("productsLitView")
    .Editable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model => model.Id("ProductID"))
        .Read(read => read.Action("Products_Read", "ListView"))
        .Update(update => update.Action("Products_Update", "ListView"))
        .PageSize(21)
    )
)

AutoBind(System.Boolean)

If set to false the widget will not bind to the data source during initialization. In this case data binding will occur when the change event of the data source is fired. By default the widget will bind to the data source specified in the configuration.

Parameters

value System.Boolean

The value for AutoBind

Indicates whether keyboard navigation is enabled/disabled.

Parameters

value System.Boolean

The value for Navigatable

Indicates whether keyboard navigation is enabled/disabled.

TagName(System.String)

Specifies ListView wrapper element tag name.

Parameters

value System.String

The value for TagName

Selectable(System.Action<Kendo.Mvc.UI.Fluent.ListViewSelectableSettingsBuilder<T>>)

Specifies whether item selection is allowed. By default selection is disabled

Parameters

configurator System.Action<Kendo.Mvc.UI.Fluent.ListViewSelectableSettingsBuilder>

The configurator for the selectable setting.

Selectable(System.Boolean)

Specifies whether item selection is allowed. By default selection is disabled

Parameters

enabled System.Boolean

Enables or disables the selectable option.

Events(System.Action<Kendo.Mvc.UI.Fluent.ListViewEventBuilder>)

Configures the client-side events.

Parameters

configurator System.Action<Kendo.Mvc.UI.Fluent.ListViewEventBuilder>

The client events action.

Example (ASPX)

@(Html.Kendo().ListView()
    .Name("ListView")
    .Events(events => events
        .Cancel("onCancel")
    )
)
In this article
Not finding the help you need?