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

Virtual Mode

  • 3 minutes to read

In addition to bound and unbound modes, the ASPxTreeView can operate in Virtual Mode, which greatly reduces both the server load and start-up time when working with complex or dynamically created hierarchies. In Virtual Mode, data is retrieved on the server in portions, on a client request, at start-up, and when expanding nodes. In essence, child nodes are not created and initialized until their parent node is expanded for the first time. This allows you to efficiently use server resources and to avoid retrieving all the hierarchical data for the ASPxTreeView.

To activate Virtual Mode for the ASPxTreeView, handle its ASPxTreeView.VirtualModeCreateChildren event, which occurs when expanding nodes for the first time. In the event handler, you need to create a list of TreeViewVirtualNode objects representing child nodes for the currently expanded node. If a child node has no children, set its TreeViewVirtualNode.IsLeaf property to true, to prevent the display of the expand button for this node.

Note

The ASPxTreeView.SyncSelectionMode property affects the ASPxTreeView control behavior in virtual mode.

Examples

In this demo, the ASPxTreeView uses Virtual Mode to display the file/folder tree of the demo’s web site.

<dx:ASPxTreeView ID="treeView" runat="server" EnableCallBacks="true" OnVirtualModeCreateChildren="treeView_VirtualModeCreateChildren">
</dx:ASPxTreeView>
See Also