New to Telerik UI for ASP.NET MVC? Download free 30-day trial

Events

You can subscribe to all TreeList events and then use them to further customize the behavior of the control.

The example below demonstrates how to use the DataBound event that the TreeList triggers when it is loaded with data.

    @using Kendo.Mvc.UI

    @(Html.Kendo().TreeList<MyApplication.Models.EmployeeDirectoryRemoteModel>()
        .Name("treelist")
        .Columns(columns =>
        {
            columns.Add().Field(f => f.FirstName).Width(250);
            columns.Add().Field(e => e.LastName);
            columns.Add().Field(e => e.Position);
            columns.Add().Field(e => e.Extension).Title("Ext").Format("{0:#}");
        })
        .DataSource(dataSource => dataSource
            .Read(read => read.Action("GetData", "Home"))
            .Model(m => {
                m.Id(f => f.EmployeeId);
                m.ParentId(f => f.ReportsTo).Nullable(true);
                m.Field(f => f.FirstName);
                m.Field(f => f.LastName);
                m.Field(f => f.ReportsTo);
            })
        )
        .Events(events =>
        {
            events.DataBound("onDataBound");
        })
    )

    <script>
        function onDataBound(e) {
            console.log("TreeList data bound");
        }
    </script>

Next Steps

See Also

In this article