Skip to main content

TreeViewNode() Constructor

Initializes a new instance of the TreeViewNode class with default settings.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.2.dll

NuGet Package: DevExpress.Web


public TreeViewNode()


The default constructor initializes all fields to their default values.


The code below demonstrates how you can create new nodes and add them to a ASPxTreeView’s child node collection.

The image below shows the result:

TreeView - Add methods

using DevExpress.Web.ASPxTreeView;

public partial class Constructor : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e) {
    protected void Create_Nodes() {   
        //Create and list nodes
        TreeViewNode[] ChildList = {
           new TreeViewNode("Inbox", "Mail1", "~/Images/Inbox.png", "Inbox.aspx", "_self"),
           new TreeViewNode("Outbox", "Mail2", "~/Images/Outbox.png", "Outbox.aspx"),
           new TreeViewNode("Deleted Items", "Mail3", "~/Images/Deleted.png"),
           new TreeViewNode("Draft", "Mail4"),
           new TreeViewNode("Junk E-mail"),
        //Create a parent node and initialize its Text property
        TreeViewNode node = new TreeViewNode();
        node.Text = "MyMail";
        //Add the created list to the node's child collection
        //Add the node to the ASPxTreeView's child collection
See Also