aspnet-8576-components-site-navigation-and-layout-tree-view-concepts-selection.md
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.
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).
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.
Use the following properties to access the selected node style settings:
<dx:ASPxTreeView ID="ASPxTreeView1" runat="server" SyncSelectionMode="CurrentPath">
<Styles>
<Node>
<SelectedStyle BackColor="Blue"/>
<!-- ... -->
<dx:ASPxTreeView ID="ASPxTreeView1" runat="server" SyncSelectionMode="CurrentPath">
<Nodes>
<dx:TreeViewNode Text="Music">
<NodeStyle>
<SelectedStyle BackColor="Yellow"/>
<!-- ... -->
See Also