This documentation is archived and is not being maintained.

TreeNode::Checked Property

Gets or sets a value that indicates whether the node's check box is selected.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public:
property bool Checked {
	bool get ();
	void set (bool value);
}

Property Value

Type: System::Boolean
true if the node's check box is selected; otherwise, false. The default is false.

When a node displays a check box, the Checked property is commonly used to specify whether the check box is selected. When the check box associated with a node is selected, the node is automatically added to the CheckedNodes collection of the TreeView control. The Checked property can also be used to determine whether the check box is selected.

NoteNote

It is more common to determine which nodes in the TreeView control have their check boxes selected by iterating through the CheckedNodes collection.

The value of this property is stored in view state.

The following code example demonstrates how to use the Checked property to specify whether a node's check box is selected. It initializes the check boxes of nodes with a depth of one to a selected state. For this example to work correctly, you must copy the sample XML data below to a file named Newsgroup.xml.

No code example is currently available or this language may not be supported.

The following code is sample XML data for the previous example.

<category name="news.microsoft.com">
    <group name="microsoft.public.dotnet.framework.aspnet"/>
    <group name="microsoft.public.dotnet.framework.aspnet.mobile"/>
    <group name="microsoft.public.dotnet.framework.aspnet.webservices"/>
</category>

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: