Skip to main content
Tab

TreeViewVirtualNode(String) Constructor

Initializes a new instance of the TreeViewVirtualNode class with the specified setting.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

Declaration

public TreeViewVirtualNode(
    string name
)

Parameters

Name Type Description
name String

A String value specifying the name which identifies the created node. Initializes the node’s Name property.

Remarks

Use this constructor to initialize a new instance of a TreeViewVirtualNode class using the settings passed via the parameters.

Example

The code below demonstrates how you can handle the ASPxTreeView.VirtualModeCreateChildren event to create the TreeViewVirtualNode objects.

using System.Collections.Generic;
using DevExpress.Web.ASPxTreeView;

public partial class _Default : System.Web.UI.Page {

    protected void Page_Load(object sender, EventArgs e) {
    }
    protected void treeView_VirtualModeCreateChildren(object source, TreeViewVirtualModeCreateChildrenEventArgs e) {
        //Create and list nodes
        TreeViewVirtualNode[] nodeList = {
            new TreeViewVirtualNode("Mail1", "Inbox", "Images/Inbox.png", "Inbox.aspx", "_self"),
            new TreeViewVirtualNode("Mail2", "Outbox", "~/Images/Outbox.png", "Outbox.aspx"),
            new TreeViewVirtualNode("Mail3", "Deleted Items", "~/Images/Deleted.png"),
            new TreeViewVirtualNode("Mail4", "Draft"),
            new TreeViewVirtualNode("Mail5")
        };

        //Add text to the last created node
        nodeList[4].Text = "Junk E-mail";

        //Set the nodes' IsLeaf property to true to hide their expand buttons
        foreach (TreeViewVirtualNode node in nodeList) {
            node.IsLeaf = true;
        }
        e.Children = new List<TreeViewVirtualNode>(nodeList); ;
    }
}
See Also