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

Events Overview

This topic will introduce you to the client-side events of the RadTreeList control - which are the available events to handle and how to subscribe to them. Further information about each event can be read by following the links provided in the table below.

Attaching event handlers

You can execute code on a certain event in the TreeList by attaching a function to the event in the ClientSettings-ClientEvents tag of the control:

JavaScript
<telerik:RadTreeList RenderMode="Lightweight" ID="RadTreeList1" runat="server" DataKeyNames="EmployeeID" ParentDataKeyNames="ReportsTo"
	DataSourceID="SqlDataSource1" AutoGenerateColumns="true">
	<ClientSettings>
		<ClientEvents OnTreeListCreated="TreeListCreated" />
	</ClientSettings>
</telerik:RadTreeList>

Handlers can also by attached dynamically using code, for example:

JavaScript
function TreeListCreated(sender, eventArgs) {
	var treelist = sender;
	treelist.add_itemClick(ItemClick);
}

Here the event name is formed from the names in the table below by removing On and starting with a small letter.

Client-side event reference

The following table lists all RadTreeList client-side events:

 

EventDescription
OnItemClickThis event is fired when a data item is clicked in RadTreeList.
OnItemContextMenuThis event is fired when a right click on a TreeListDataItem happens.
OnItemCreatedThis event is fired when each of the TreeListDataItem client components is created.
OnItemDblClickThis event is fired when a data item is double-clicked in RadTreeList.
OnItemDeselectingThis event is fired when a TreeListDataItem is about to be deselected on the client. This event can be canceled.
OnItemDeselectedThis event is fired when a TreeListDataItem is deselected on the client.
OnItemDragStartedThis event is fired when a drag action is started upon the TreeListDataItem.
OnItemDraggingThis event is fired when a TreeListDataItem is being dragged.
OnItemDroppingThis event is fired when a TreeListDataItem is being dropped.
OnItemDroppedThis event is fired when a TreeListDataItem has been dropped after dragging.
OnItemSelectingThis event is fired when a TreeListDataItem is about to be selected on the client. This event can be canceled.
OnItemSelectedThis event is fired when a TreeListDataItem is selected on the client.
OnKeyPressThis event is fired (only when Keyboard Navigation is enabled) when any key is pressed inside the RadTreeList andthe treelist control is about to process this key.
OnScrollThis event is fired when the treelist is scrolled.
OnTreeListCreatingThis event is fired when the RadTreeList client component is initializing.
OnTreeListCreatedThis event is fired when the RadTreeList client component is initialized.
OnTreeListDestroyingThis event is fired when the RadTreeList client component is about to be disposed.
OnColumnResizingThis event is fired before the treelist column is resized.
OnColumnResizedThis event is fired after the treelist column is resized.