Skip to main content


  • 2 minutes to read

ASPxTreeView allows users to click a node to select it in the UI. In code, you can select a node on the client and server sides.

TreeView - Selection

Select a Node

Set the AllowSelectNode property to true, to allow runtime selection.

The ASPxTreeView can automatically select the node whose NavigateUrl property value points to the currently browsed web page. Specify the SyncSelectionMode property value to choose the synchronization mode.

<dx:ASPxTreeView ID="treeView" runat="server" AllowSelectNode="true" SyncSelectionMode="CurrentPath">

The following members allow you to specify the selected node:

  • On the server, use the SelectedNode property. To clear selected nodes, set the property value to null (Nothing for VB).

    TreeViewNode node = ASPxTreeView.SelectedNode;
    ASPxTreeView.SelectedNode = null;
  • On the client, use the SetSelectedNode(node) method to set the selected node. Pass null as a method’s parameter to clear selected nodes. To obtain the currently selected node, use the GetSelectedNode method.

    var node = treeview.GetSelectedNode();

Style Settings

Use the following properties to access the selected node style settings:

  • The Node property specifies the style settings for all TreeView nodes.
    <dx:ASPxTreeView ID="ASPxTreeView1" runat="server" SyncSelectionMode="CurrentPath">
                    <SelectedStyle BackColor="Blue"/>
                    <!-- ... -->
  • The NodeStyle property specifies the style settings for a particular node.
        <dx:ASPxTreeView ID="ASPxTreeView1" runat="server" SyncSelectionMode="CurrentPath">
                <dx:TreeViewNode Text="Music">
                        <SelectedStyle BackColor="Yellow"/>
                        <!-- ... -->
See Also