This is a migrated thread and some comments may be shown as answers.
ListView on Change, get "primary key" for selected item
1 Answer 81 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Jillian asked on 25 Jul 2013, 07:22 PM
I have a list view that has a change event.  When an item in my list view is selected how can I get the "key" that i set for the item instead of the text displayed?

<script type="text/x-kendo-tmpl" id="ItemTemplate">
  <div style="margin:5px;">
    #:ItemNo# - #:Description#<br />
<%: Html.Kendo().ListView<ItemList>()
.Name("Items")<br>  .TagName("div"
 .DataSource(ds =>
     ds.Read(read => read.Action("ItemListRead", "Home"))
       .Model(m => m.Id(i => i.ItemKey)))
 .Selectable(s => s.Mode(ListViewSelectionMode.Single))
 .Events(events => events.Change("onChange"))

<script type="text/javascript">
   function onProjectItemChange(e) {
      var selected = $.map(, function (item) {
         return $(item).text();

1 Answer, 1 is accepted

Sort by
Dimiter Madjarov
Telerik team
answered on 29 Jul 2013, 08:10 AM
Hello Jillian,

To achieve this you could get the uid of the selected item through the data-uid attribute and use the getByUid method of the DataSource to retrieve the model for it.
function onChange(arg) {
    var selected =;
    var model = this.dataSource.getByUid(selected.attr("data-uid"));

I hope that this was the information that you were looking for. I wish you a great day!


Dimiter Madjarov
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Asked by
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question