OnClientNodeExpanding
The OnClientNodeExpanding client-side event occurs when the user clicks the expand (plus) button. The event is called just prior to postback or URL redirection and can be canceled.
Calling the client-side expand() or set_expanded(true) method does not fire OnClientNodeExpanding and OnClientNodeExpanded client-side events. More information is available here.
The event handler receives parameters:
The TreeView instance that fired the event.
Event arguments with functions:
get_node() retrieves a reference to the clicked on node.
set_cancel() - call this function to specify whether the event should be canceled (true) or not (false).
get_domEvent() retrieves a DOM event object of the node expand.
The example below shows how to prevent expanding a "Recent Searches" node. Note that the OnClientNodeExpanded event does not fire when the expand (plus) button is clicked.
<telerik:RadTreeView RenderMode="Lightweight" ID="RadTreeView1" runat="server" AllowNodeEditing="True"
OnClientNodeExpanded="ClientNodeExpanded"
OnClientNodeExpanding="ClientNodeExpanding">
</telerik:RadTreeView>
function ClientNodeExpanded(sender, eventArgs)
{
alert("OnClientNodeExpanded");
}
function ClientNodeExpanding(sender, eventArgs)
{
var node = eventArgs.get_node();
if(node.get_text() == "Recent Searches")
{
eventArgs.set_cancel(true);
}
}