New to Kendo UI for jQueryStart a free 30-day trial

Access Selected DataValueField in the ListBox

Environment

ProductProgress® Telerik UI® ListBox for ASP.NET MVC
Operating SystemWindows 10 64bit
BrowserIE For PC
Browser Version11
.NET FrameworkVersion 4.6
Visual Studio VersionVisual Studio 2017
Preferred LanguageC Sharp
MVC VersionMVC 5
View EngineRazor

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:

    js
    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