This documentation is archived and is not being maintained.

TreeNode.SelectAction Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets the event or events to raise when a node is selected.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public:
property TreeNodeSelectAction SelectAction {
	TreeNodeSelectAction get ();
	void set (TreeNodeSelectAction value);
}
/** @property */
public TreeNodeSelectAction get_SelectAction ()

/** @property */
public void set_SelectAction (TreeNodeSelectAction value)

public function get SelectAction () : TreeNodeSelectAction

public function set SelectAction (value : TreeNodeSelectAction)

Property Value

One of the TreeNodeSelectAction values. The default is TreeNodeSelectAction.Select.

The text of a node in the TreeView control can be in one of two modes: selection mode or navigation mode. By default, a node is in selection mode. To put a node into navigation mode, set the node's NavigateUrl property to a value other than an empty string (""). To put a node into selection mode, set the node's NavigateUrl property to an empty string.

NoteNote

When a node is in navigation mode, selection events are disabled for that node. Clicking a node will direct the user to the specified URL, rather than posting the page back to the server and raising an event.

When a node is in selection mode, use the SelectAction property to specify which event or events are raised when a node is selected. The following table lists the available options.

Selection action

Description

TreeNodeSelectAction.Expand

Toggles the node between expanded and collapsed. Raises the TreeNodeExpanded event or the TreeNodeCollapsed event as appropriate.

TreeNodeSelectAction.None

Raises no events when a node is selected.

TreeNodeSelectAction.Select

Raises the SelectedNodeChanged event when a node is selected.

TreeNodeSelectAction.SelectExpand

Raises both the SelectedNodeChanged and the TreeNodeExpanded events when a node is selected. Nodes are only expanded, never collapsed.

NoteNote

The HoverNodeStyle property is not rendered for a node with its SelectAction property set to TreeNodeSelectAction.None.

The value of this property is stored in view state.

TopicLocation
How to: Add or Delete TreeView Node Elements (Visual Studio)Building ASP .NET Web Applications in Visual Studio

The following code example demonstrates how to use the SelectAction property to specify which event is raised when a node is clicked.

No code example is currently available or this language may not be supported.

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0
Show: