New to Telerik UI for ASP.NET MVCStart a free 30-day trial

ASP.NET MVC ListView Overview

The Telerik UI ListView HtmlHelper for ASP.NET MVC is a server-side wrapper for the Kendo UI ListView widget.

The ListView enables you to display a custom layout of data-bound items. The ListView is ideally suited for displaying a list of items in a consistent manner. You can see commonplace examples of its use in the design structures of the Internet, search engine results, tweets from Twitter, Facebook updates, inbox items in Gmail, card lists in Trello, and so on.

The ListView enables you to control the display of data. It does not provide a default rendering of data-bound items. Instead, it relies on templates to define the way a list of items is displayed, including alternating items and items that are in the process of editing.

Initializing the ListView

The following example demonstrates how to define the ListView.

  • The TagName of the ListView for ASP.NET MVC is used to create an element to contain all ListView items once the ListView is bound.
  • The ClientTemplateId is mandatory for the ListView. It contains the id of the script element which accommodates the item template.
Razor
    @(Html.Kendo().ListView() 
        .Name("productListView") // The name of the ListView is mandatory. It specifies the "id" attribute of the widget.
        .TagName("div") // The tag name of the ListView is mandatory. It specifies the element which wraps all ListView items.
        .ClientTemplateId("template") // This template will be used for rendering the ListView items.
        .DataSource(dataSource => {
                dataSource.Read(read => read.Action("Products_Read", "ListView"));
        }) // The DataSource configuration. It will be used on paging.
        .Pageable() // Enable paging.
    )

Basic Configuration

The following example demonstrates the basic configuration for the ListView.

Razor
    @(Html.Kendo().ListView<Kendo.Mvc.Examples.Models.ProductViewModel>(Model)
        .Name("listView")
        .TagName("div")
        .ClientTemplateId("template")
        .DataSource(dataSource => dataSource
            .Model(model => model.Id("ProductID"))
            .PageSize(4)
            .Read(read => read.Action("Editing_Read", "ListView"))
            .Update(update => update.Action("Editing_Update", "ListView"))
            .Destroy(destroy => destroy.Action("Editing_Destroy", "ListView"))
        )
        .Pageable()
        .Editable()
    )

Functionality and Features

FeatureDescription
Ajax bindingYou can bind the ListView to an Ajax DataSource which formats the request and parses the server response out-of-the-box.
EditingTo customize the editing functionality of the ListView, configure the provided editing templates.
PagingThe ListView component supports the paging functionality.
TemplatesTo customize the visualization of the ListView items, use the provided Kendo templates.
Scroll modesListView enables you to use the default scroll mode or utilize endless scrolling.
SelectionChoose between single or multiple selection mode.
GlobalizationThe ListView component allows you to adapt your apps for international users by translating the component messages and applying a right-to-left layout.
AccessibilityThe ListView is accessible by screen readers and provides WAI-ARIA, Section 508, WCAG 2.2, and keyboard support.

Next Steps

See Also