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

ASP.NET MVC ListBox Overview

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

The ListBox displays a list of data inside a box and allows single or multiple selections, reordering of selected items, deleting items, fast keyboard-only navigation through the component items, as well as dragging and dropping items. You can also connect the ListBox to other ListBoxes and customize its items with templates, toolbar positioning, placeholders, hints, and localization of its command buttons' messages.

Initializing the ListBox

The following example demonstrates how to define the ListBox.

Razor
   @(Html.Kendo().ListBox()
        .Name("optional")
        .Toolbar(toolbar =>
        {
            toolbar.Position(Kendo.Mvc.UI.Fluent.ListBoxToolbarPosition.Right);
            toolbar.Tools(tools => tools
                .MoveUp()
                .MoveDown()
            );
        })
        .BindTo(ViewBag.Attendees)
    )

Basic Configuration

The following example demonstrates the basic configuration of two connected ListBox components.

Razor
    @(Html.Kendo().ListBox()
        .Name("listbox1")
        .DataValueField("ProductID")
        .DataTextField("ProductName")
        .DataSource(source => source
            .Read(read => read.Action("GetProducts", "ListBox"))
        )
        .ConnectWith("listbox2")
        .Toolbar(toolbar =>
        {
            toolbar.Position(ListBoxToolbarPosition.Right);
            toolbar.Tools(tools => tools
                .MoveUp()
                .MoveDown()
                .TransferTo()
                .TransferFrom()
                .TransferAllTo()
                .TransferAllFrom()
                .Remove());
        })
        .BindTo(new List<ProductViewModel>())
    )

    @(Html.Kendo().ListBox()
        .Name("listbox2")
        .DataValueField("ProductID")
        .DataTextField("ProductName")
        .ConnectWith("listbox1")
        .BindTo(new List<ProductViewModel>())
    )

Functionality and Features

FeatureDescription
Data BindingThe ListBox can bind to local data collections or remote data.
Item templatesYou can use the component template option to customize the rendering of its items.
Dragging and droppingEnable the drag-and-drop feature of the ListBox items.
SelectionThe component supports single and multiple selection modes.
EventsThe ListBox emits various events that you can handle and use to control what happens during the user interaction.
GlobalizationThe ListBox provides globalization through the combination of localization and right-to-left support.
AccessibilityThe ListBox is accessible for screen readers, supports WAI-ARIA attributes, and delivers keyboard shortcuts for faster navigation.

Next Steps

See Also