Events
The Telerik UI ListView for ASP.NET MVC exposes a number of JavaScript events that allow you to control the behavior of the UI component.
For a complete example of how to handle all ListView events triggered by user interaction, refer to the demo on using the events of the ListView .
Subscribing to Events
The following example demonstrates how to subscribe to the DataBound
event.
@(Html.Kendo().ListView<Kendo.Mvc.Examples.Models.ProductViewModel>()
.Name("listView")
.TagName("ul")
.ClientTemplateId("template")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Products_Read", "ListView"))
.PageSize(21)
)
.Pageable(pageable => pageable
.Refresh(true)
.ButtonCount(5)
.PageSizes(new[] { 5, 15, 21 })
)
.Events(e=>e.DataBound("onDataBound"))
)
<script>
function onDataBound(e){
var listview = $("#listView").data("kendoListView");
listview.setOptions({selectable: "single"}); // Turn on the selectable mode of the ListView.
listview.select(listview.content.children().first()); // Select the first item.
}
</script>