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


The OnClientNodePopulationFailed client-side event occurs when:

  • Child nodes are loaded on-demand.

  • The parent node ExpandMode property is ServerSideCallback or WebService.

  • An exception occurs while loading.

The event handler receives parameters:

  1. The TreeView instance that fired the event.

  2. Event arguments with functions:

  • get_node() retrieves a reference to the parent node.

  • get_errorMessage() retrieves the exception message text.

  • set_cancel() - call this function to specify whether the event should be canceled (true) or not (false). Canceling of the event will prevent the exception from propagating.

  • get_domEvent() retrieves a DOM event object.

In the example below an exception is raised in the server-side NodeExpand event handler

<telerik:RadTreeView RenderMode="Lightweight" ID="RadTreeView1" runat="server" OnClientNodePopulationFailed="ClientNodePopulationFailed"
        <telerik:RadTreeNode runat="server" ExpandMode="ClientSide" Text="Search" ImageUrl="~/images/search.ico"
            Expanded="True" Value="1">
                <telerik:RadTreeNode runat="server" ExpandMode="ServerSideCallBack" Text="Recent Searches">
                <telerik:RadTreeNode runat="server" ExpandMode="ServerSideCallBack" Text="Network Locations">
function ClientNodePopulationFailed(sender, eventArgs) {

    var node = eventArgs.get_node();
    var message = eventArgs.get_errorMessage();

    alert("OnClientNodePopulationFailed fired for node " +
        node.get_text() +
        " with message[" +
        message + "]");


Note that the custom alert will appear on remote clients, only if the customErrors mode is set to Off in the web.config:

The server NodeExpand event handler for the RadTreeView defined above:

protected void RadTreeView1_NodeExpand(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
    throw new ApplicationException("An error occurred while attempting to populate " + e.Node.Text);
Protected Sub RadTreeView1_NodeExpand(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTreeNodeEventArgs)
    Throw New ApplicationException("An error occurred while attempting to populate " + e.Node.Text)
End Sub

See Also

In this article