New to Kendo UI for jQuery? Download free 30-day trial

Access Selected DataValueField in the ListBox

Environment

Product Progress® Telerik UI® ListBox for ASP.NET MVC
Operating System Windows 10 64bit
Browser IE For PC
Browser Version 11
.NET Framework Version 4.6
Visual Studio Version Visual Studio 2017
Preferred Language C Sharp
MVC Version MVC 5
View Engine Razor

Description

How can I get the DataValueField from the selected item on the change event of the Kendo UI ListBox? 

Solution

To achieve the desired scenario:

  1. Retrieve the selected element.
  2. Based on the selected element, retrieve the information for the dataItem that is associated with the following line:

    function onChange(e) {
        var element = e.sender.select();
        var dataItem = e.sender.dataItem(element[0])
        console.log(dataItem)
    }
    

For more information, refer to the articles on:

  • The change event of the ListBox.
  • The dataItem method of the ListBox.

See Also

In this article