Tab

TreeViewVirtualNode(String, String, String, String, String) Constructor

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

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

Declaration

public TreeViewVirtualNode(
    string name,
    string text,
    string imageUrl,
    string navigateUrl,
    string target
)
Public Sub New(
    name As String,
    text As String,
    imageUrl As String,
    navigateUrl As String,
    target As String
)

Parameters

Name Type Description
name String

A String value specifying the name which identifies the created node. This value is assigned to the TreeViewVirtualNode.Name property.

text String

A String value specifying the node's display text. This value is assigned to the TreeViewNode.Text property.

imageUrl String

A String value specifying the path to the node image. This value is assigned to the ImagePropertiesBase.Url property.

navigateUrl String

A String value specifying the URL to which the browser navigates when the node is clicked. This value is assigned to the TreeViewNode.NavigateUrl

target String

A String value which identifies the window or frame at which to target URL content when the node is clicked. This value is assigned to the TreeViewNode.Target

Remarks

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

Examples

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