TreeView::ShowCheckBoxes Property
Gets or sets a value indicating which node types will display a check box in the TreeView control.
Assembly: System.Web (in System.Web.dll)
public: property TreeNodeTypes ShowCheckBoxes { TreeNodeTypes get (); void set (TreeNodeTypes value); }
<asp:TreeView ShowCheckBoxes="TreeNodeTypes" />
Property Value
Type: System.Web.UI.WebControls::TreeNodeTypesA bitwise combination of the TreeNodeTypes values. The default is TreeNodeType.None.
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | The bitwise combination value is outside the range of the TreeNodeTypes enumeration. |
To provide multi-node selection support in the TreeView control, you can display check boxes next to the image for a node. Use the ShowCheckBoxes property to specify which node types will display a check box. For example, if this property is set to TreeNodeType.Parent, check boxes are displayed for each parent node in the tree. The following table lists the valid values for this property.
Node type | Description |
|---|---|
TreeNodeType.All | Check boxes are displayed for all nodes. |
TreeNodeType.Leaf | Check boxes are displayed for all leaf nodes. |
TreeNodeType.None | Check boxes are not displayed. |
TreeNodeType.Parent | Check boxes are displayed for all parent nodes. |
TreeNodeType.Root | Check boxes are displayed for all root nodes. |
The enumeration type that is used for the ShowCheckBoxes property is a flag enumeration, which allows you to combine values through bitwise operations. For example, to display check boxes for the parent and leaf nodes, use the bitwise OR operator to combine the TreeNodeType.Parent and TreeNodeType.Leaf values.
To determine which nodes have their check box selected, iterate through the nodes of the CheckedNodes collection.
Note: |
|---|
You can override the ShowCheckBoxes setting by setting the ShowCheckBox property for each node. |
If you need to provide only single-selection support, consider using the SelectedNode property.
The value of this property is stored in view state.
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: