Edit this page

Events Overview

RadTreeView supports a number of client-side events that let you customize behavior:

To use these events, write a javascript function that can be called when an event occurs. Then assign the name of the JavaScript function as the value of the corresponding RadTreeView event property.

<telerik:RadTreeView RenderMode="Lightweight" 
    ID="RadTreeView1" 
    runat="server"  
    OnClientNodeClicked="ClientNodeClicked">
</telerik:RadTreeView>
function ClientNodeClicked(sender, eventArgs) 
{
    var node = eventArgs.get_node();
    alert("You clicked " + node.get_text());
}

You can also assign event handlers in client-side code:

function AssignEventHandler()
{
    var tree = $find("<%= RadTreeView1.ClientID %>");
    tree.add_nodeClicked(ClientNodeClicked);
}   

Another advantage of the client-side API is that you can detach an event handler dynamically:

function removeOnClicked2()
{
    var tree = $find("<%= RadTreeView1.ClientID %>");
    tree.remove_nodeClicked(ClientNodeClicked);
}   

For a live example of using client-side events, see Client-Side Events Demo.