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

Kendo.Mvc.UI.Fluent.ListViewBuilder

Defines the fluent interface for configuring the 1.

Methods

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

Binds the ListView to a list of objects

Parameters

dataSource System.Collections.Generic.IEnumerable<T>

The data source.

Example (ASPX)

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

BindTo(System.Collections.IEnumerable)

Binds the ListView to a list of objects

Parameters

dataSource System.Collections.IEnumerable

The IEnumerable list of objects.

Example (ASPX)

@(Html.Kendo().ListView<ProductViewModel>()
    .Name("productsListView")
    .BindTo((IEnumerable)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("productsListView")
    .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("productsListView")
    .Pageable(paging=>paging.Numeric(true).PreviousNext(true).PageSizes(false))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("Products_Read", "ListView"))
        .PageSize(21)
    )
)

Scrollable

If set to true the listview will display a scrollbar when the content exceeds the listview height value. By default scrolling is disabled.

Scrollable(Kendo.Mvc.UI.ListViewScrollableMode)

In endless scrolling mode the listview should be configured to display a scrollbar. Scrolling to the end of the scrollbar will load more items (equal to the pageSize number) and append them to the listview DOM element utill all items are loaded and displayed.

Parameters

mode Kendo.Mvc.UI.ListViewScrollableMode

The value for Scrollable

Enables keyboard navigation.

Example (ASPX)

@(Html.Kendo().ListView<ProductViewModel>()
    .Name("productsListView")
    .Navigatable()
    .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("productsListView")
    .Selectable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("Products_Read", "ListView"))
        .PageSize(21)
    )
)

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

Enables selection in the specified selection mode.

Parameters

selectionAction System.Action<Kendo.Mvc.UI.Fluent.ListViewSelectionSettingsBuilder>

Use builder to define the selection mode.

Example (ASPX)

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

AutoBind(System.Boolean)

Specifies if the ListView should be automatically bound on initial load. This is only possible if AJAX binding is used, and widget is not initialy populated on the server.

Parameters

value System.Boolean

If true ListView will be automatically data bound, otherwise false

TagName(System.String)

Specifies ListView wrapper element tag name.

Example (ASPX)

@(Html.Kendo().ListView<ProductViewModel>()
    .Name("productsListView")
    .TagName("div")
)

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("productsListView")
    .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("productsListView")
    .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)
    )
)

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<ProductViewModel>()
    .Name("productsListView")
    .Events(events => events
        .DataBound("onDataBound")
    )
)

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

Binds the ListView to a DataSource.

Parameters

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

The 1 configurator.

Example (ASPX)

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

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("productsListView")
    .DataSource("dataSource1")
)

Bordered(System.Boolean)

Renders border around the listview element.

Parameters

value System.Boolean

The value for Bordered

Borders(System.String)

Renders border around the listview items. Valid values are: all: renders borders around listview items.; horizontal: renders top border of listview items. Useful when setting layout: "flex" and flex.direction: column. or vertical: renders top border of listview items. Useful when setting layout: "flex" and flex.direction: row..

Parameters

value System.String

The value for Borders

Layout(System.String)

Specify the layout of listview content. Valid options are: flex: This is equivalent to display: flex. It defines a flex container and enables a flex context for all its direct children. Think of flex items as primarily laying out either in horizontal rows or vertical columns. or grid: This is equivalent to display: grid. It defines the element as a grid container and establishes a new grid formatting context for its contents..

Parameters

value System.String

The value for Layout

Flex(System.Action<Kendo.Mvc.UI.Fluent.ListViewFlexSettingsBuilder>)

Flex layout settings

Parameters

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

The configurator for the flex setting.

Grid(System.Action<Kendo.Mvc.UI.Fluent.ListViewGridSettingsBuilder>)

Grid layout settings.

Parameters

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

The configurator for the grid setting.

ContentElement(System.String)

Defines the type of element that holds the listview content.

Parameters

value System.String

The value for ContentElement

In this article
Not finding the help you need?