ListBox HtmlHelper Overview

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

The ListBox provides suggestions depending on the typed text and allows multiple value entries. displays a list of data that is contained in a box and allows single or multiple selection, reordering of selected items, and deleting items and features keyboard navigation as well as the dragging and dropping of items. You can also connect the ListBox with another list-box and customize the widget with the use of templates, toolbar positioning, placeholder and hint, and localization of its command buttons messages.

Initializing the ListBox

The following example demonstrates how to define the ListBox by using the ListBox 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)
    )
    public ActionResult Index()
    {
        ViewBag.Attendees = new List<string>
        {
            "Steven White",
            "Nancy King",
            "Nancy Davolio",
            "Robert Davolio",
            "Michael Leverling",
            "Andrew Callahan",
            "Michael Suyama"
        };
        return View();
    }

Functionality and Features

Events

For a complete example on basic ListBox events, refer to the demo on using the events of the ListBox.

Referencing Existing Instances

To reference an existing ListBox instance, use the jQuery.data() configuration option. Once a reference is established, use the ListBox API to control its behavior.

The following example demonstrates how to access an existing ListBox instance.

  // Place the following after your ListBox for ASP.NET Core declaration.
  <script>
  $(function() {
  // The Name() of the ListBox is used to get its client-side instance.
      var listbox = $("#listbox").getKendoListBox();
  });
  </script>

See Also

In this article
Not finding the help you need? Improve this article