TreeNodeBinding::SelectAction Property
Gets or sets the event or events to raise when a node to which the TreeNodeBinding object is applied is selected.
Assembly: System.Web (in System.Web.dll)
public: property TreeNodeSelectAction SelectAction { TreeNodeSelectAction get (); void set (TreeNodeSelectAction value); }
Property Value
Type: System.Web.UI.WebControls::TreeNodeSelectActionOne 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 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.
Note: