# 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.

* [Demo page for the ListBox HtmlHelper](https://demos.telerik.com/aspnet-mvc/listbox/index)

## Initializing the ListBox

The following example demonstrates how to define the ListBox.

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

```C# Controller
    public ActionResult Index()
    {
        ViewBag.Attendees = new List<string>
        {
            "Steven White",
            "Nancy King",
            "Nancy Davolio",
            "Robert Davolio",
            "Michael Leverling",
            "Andrew Callahan",
            "Michael Suyama"
        };
        return View();
    }
```

## Basic Configuration

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

```Razor HtmlHelper
    @(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>())
    )
```

```C# ListBoxController

    public ActionResult GetProducts()
    {
        var products = Enumerable.Empty<ProductViewModel>();

        using (var northwind = GetContext())
        {
            products = northwind.Products.Select(product => new ProductViewModel
            {
                ProductID = product.ProductID,
                ProductName = product.ProductName
            }).ToList();
        }
        return Json(products, JsonRequestBehavior.AllowGet);
    }
```

## Functionality and Features

| Feature                                                                                                               | Description                                                                                                                                                                                                                                                                                                                  |
| --------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Data Binding](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/editors/listbox/binding/overview)        | The ListBox can bind to local data collections or remote data.                                                                                                                                                                                                                                                               |
| [Item templates](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/editors/listbox/templates)             | You can use the component template option to customize the rendering of its items.                                                                                                                                                                                                                                           |
| [Dragging and dropping](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/editors/listbox/draganddrop)    | Enable the drag-and-drop feature of the ListBox items.                                                                                                                                                                                                                                                                       |
| [Selection](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/editors/listbox/selection)                  | The component supports single and multiple selection modes.                                                                                                                                                                                                                                                                  |
| [Events](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/editors/listbox/events)                        | The ListBox emits various events that you can handle and use to control what happens during the user interaction.                                                                                                                                                                                                            |
| [Globalization](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/editors/listbox/globalization/overview) | The ListBox provides globalization through the combination of [localization](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/editors/listbox/globalization/localization) and [right-to-left support](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/editors/listbox/globalization/rtl-support). |
| [Accessibility](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/editors/listbox/accessibility/overview) | The ListBox is accessible for screen readers, supports WAI-ARIA attributes, and delivers [keyboard shortcuts](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/editors/listbox/accessibility/keyboard-navigation) for faster navigation.                                                                        |

## Next Steps

* [Getting Started with the ListBox](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/editors/listbox/getting-started)
* [Basic Usage of the ListBox HtmlHelper for ASP.NET MVC (Demo)](https://demos.telerik.com/aspnet-mvc/listbox/index)

## See Also

* [Using the API of the ListBox for ASP.NET MVC (Demo)](https://demos.telerik.com/aspnet-mvc/listbox/api)
* [Knowledge Base Section](https://www.telerik.com/aspnet-mvc/documentation/knowledge-base)
