This documentation is archived and is not being maintained.

TreeNode.PopulateOnDemand Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets a value that indicates whether the node is populated dynamically.

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

property bool PopulateOnDemand {
	bool get ();
	void set (bool value);
/** @property */
public boolean get_PopulateOnDemand ()

/** @property */
public void set_PopulateOnDemand (boolean value)

public function get PopulateOnDemand () : boolean

public function set PopulateOnDemand (value : boolean)

Property Value

true to populate the node dynamically; otherwise, false. The default is false.

Sometimes, it is not practical to statically predefine the tree structure due to data size or custom content that depends on user input. Because of this, the TreeView control supports dynamic node population. When a node's PopulateOnDemand property is set to true, that node is populated at run time through a postback event when the node is expanded. To populate a node dynamically, an event-handling method that populates the node must be defined for the TreeNodePopulate event.

Supported browsers can also take advantage of client-side node population. When enabled, this allows the TreeView control to dynamically populate a node on the client when that node is expanded, which prevents the need to post back to the server. For more information on client-side node population, see PopulateNodesFromClient.

The value of this property is stored in view state.

The following code example demonstrates how to use the PopulateOnDemand property to indicate that a node is populated dynamically.

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

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0