New to Telerik UI for ASP.NET CoreStart a free 30-day trial

Using the API

The TreeList provides an API which enables you to use its methods, fields, and events.

Methods and Fields

The TreeList exposes a set of methods and fields.

Razor
    @(Html.Kendo().TreeList<dynamic>()
        .Name("treelist")
        .Columns(x=> {
            x.Add().Field("Name");
            x.Add().Field("Position");
        })
        .DataSource("dataSource")
        )

Events

The TreeList supports a set of events to which you can subscribe.

To handle the events, either:

  • Specify the JavaScript function which will handle the event during the initialization of the widget, or
  • Use the bind method of the widget after initialization.

The event handler is the JavaScript function which is invoked when the event is fired. The argument of the event handler is a JavaScript object which contains event-specific data. Get a reference of the widget, which fired the event, through the sender field of the event argument. The function context of the event handler, which is available through the this keyword, is set to the instance of the widget which fired the event.

The following example demonstrates how to subscribe to a TreeList event during the initialization of the widget.

Razor
    @(Html.Kendo().TreeList<dynamic>()
        .Name("treelist")
        .Columns(x =>
        {
            x.Add().Field("Name");
            x.Add().Field("Position");
        })
        .DataSource("dataSource")
        .Events(x=> x.DataBound("dataBound"))
    )

The following example demonstrates how to subscribe to a TreeList event by using the bind method.

Razor
    @(Html.Kendo().TreeList<dynamic>()
        .Name("treelist")
        .Columns(x =>
        {
            x.Add().Field("Name");
            x.Add().Field("Position");
        })
        .DataSource("dataSource")
    )

See Also

In this article
Methods and FieldsEventsSee Also
Not finding the help you need?
Contact Support