asp.net.ph

TreeView.ShowCheckBoxes Property

System.Web.UI.WebControls Namespace   TreeView Class


.NET Framework version 2.0

Sets or retireves a value indicating which node types will display a check box in a TreeView control.

Syntax


Inline <asp:treeview showcheckboxes = enumValue [ , enumValue ] ... >
Script TreeView.ShowCheckBoxes = TreeNodeType.enumValue [ ||TreeNodeType.enumValue ]

Property Value


enumValue A bitwise combination of the TreeNodeTypes enumeration values.

The property is read/write with a default value of None.

Remarks

Use the ShowCheckBoxes property to specify which node types in a TreeView control will display a check box.

To provide multi-node selection support in the TreeView control, you can display check boxes next to the image for a node. For example, if this property is set to 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 a comma-separated list when setting the property declaratively
    showcheckboxes = "Parent, Leaf"
  • use the bitwise OR operator when setting the property programmatically
    myTreeView.ShowCheckBoxes = TreeNodeType.Parent||TreeNodeType.Leaf

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-node selection support, consider using the SelectedNode property.

See Also

TreeView Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph