Skip to main content
A newer version of this page is available. .
Tab

TreeViewNode.AllowCheck Property

Gets or sets a value to enable/disable the check box for a particular node.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

NuGet Package: DevExpress.Web

Declaration

[DefaultValue(true)]
public bool AllowCheck { get; set; }

Property Value

Type Default Description
Boolean **true**

true if a check box is available; otherwise, false.

Remarks

The ASPxTreeView allows end-users to check nodes using node check boxes. The entire availability of node check boxes is controlled by the ASPxTreeView.AllowCheckNodes property. For individual nodes, the visibility of their check boxes can be specified using the AllowCheck property on the node level. A particular node’s check box is enabled if both the control’s ASPxTreeView.AllowCheckNodes and the node’s AllowCheck properties are set to true.

Note that the AllowCheck property doesn’t change a node’s checked state. It only hides/shows a check box. The checked state of an individual node can be specified using the node’s TreeViewNode.Checked property.

For more information, see the Check Box Support topic.

Example

This example demonstrates how you can use the ASPxTreeView's AllowCheckNodes and TreeViewNode's AllowCheck properties to manage the visibility of check boxes.See also:TreeView - How to manage the visibility of check boxes via the AllowCheck property

View Example

<dx:ASPxRadioButtonList ID="ASPxRadioButtonList1" runat="server" 
    AutoPostBack="True" ClientIDMode="AutoID" 
    onselectedindexchanged="ASPxRadioButtonList1_SelectedIndexChanged" 
    SelectedIndex="0">
    <Items>
        <dx:ListEditItem Text="Hide all check boxes" Value="HideAll" />
        <dx:ListEditItem Text="Show check boxes for leaf nodes only" Value="ShowLeaves" />
        <dx:ListEditItem Text="Show all check boxes" Value="Show" />
    </Items>
</dx:ASPxRadioButtonList>


<dx:ASPxTreeView ID="ASPxTreeView1" runat="server" ClientIDMode="AutoID">
    <Nodes>
        <dx:TreeViewNode>
            <Nodes>
                <dx:TreeViewNode>
                    <Nodes>
                        <dx:TreeViewNode>
                        </dx:TreeViewNode>
                        <dx:TreeViewNode>
                        </dx:TreeViewNode>
                    </Nodes>
                </dx:TreeViewNode>
                <dx:TreeViewNode>
                </dx:TreeViewNode>
            </Nodes>
        </dx:TreeViewNode>
        <dx:TreeViewNode>
            <Nodes>
                <dx:TreeViewNode>
                </dx:TreeViewNode>
                <dx:TreeViewNode>
                </dx:TreeViewNode>
                <dx:TreeViewNode>
                </dx:TreeViewNode>
                <dx:TreeViewNode>
                </dx:TreeViewNode>
            </Nodes>
        </dx:TreeViewNode>
    </Nodes>
</dx:ASPxTreeView>
         <br />
         <br />
         <dx:ASPxButton ID="ASPxButton1" runat="server" OnClick="ASPxButton1_Click" Text="Disable checked nodes">
         </dx:ASPxButton>
         <br />
         <dx:ASPxButton ID="ASPxButton2" runat="server" OnClick="ASPxButton2_Click" Text="Enable checked nodes">
         </dx:ASPxButton>
See Also