This documentation is archived and is not being maintained.

TreeNode::SelectAction Property

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 Value

Type: System.Web.UI.WebControls::TreeNodeSelectAction
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 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0
Show: