TreeNodeBinding.SelectAction Property
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.When the TreeView control is bound to a data source, use the SelectAction property to specify the value to bind to the SelectAction property of a TreeNode object. This binding relationship affects all TreeNode objects to which the TreeNodeBinding object is applied. The SelectAction property is used to specify which event or events are raised when a node is selected.
Note |
|---|
| You can selectively override the SelectAction property by setting the SelectAction property of each node directly. |
The following table lists the available options.
| SelectAction value | 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 TreeNodeExpanded events when a node is selected. Nodes are only expanded, never collapsed. |
Note |
|---|
| The HoverNodeStyle is not rendered for a node with its SelectAction property set to TreeNodeSelectAction.None. |
The value of this property is stored in view state.
This section contains two code examples. The first code example demonstrates how to use the SelectAction property to specify which event is raised when a node is clicked. The second code example provides sample XML data for the first code example.
The following example demonstrates how to use the SelectAction property to specify which event is raised when a node is clicked. For this example to work correctly, you must copy the sample XML data, provided after this code example, to a file named Book.xml.
The following code example provides sample XML data for the preceding code example.
<Book Title="Book Title">
<Chapter Heading="Chapter 1">
<Section Heading="Section 1">
</Section>
<Section Heading="Section 2">
</Section>
</Chapter>
<Chapter Heading="Chapter 2">
<Section Heading="Section 1">
</Section>
</Chapter>
<Appendix Heading="Appendix A">
</Appendix>
</Book>
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.
Note