TreeView for ASP.NET WebForms
Adding a Top-Level Node
Task-Based Help > Adding a Top-Level Node

This topic illustrates how to add a top-level node to a C1TreeView control in Design view, in Source view, and in code.

In Design View

Complete the following steps:

  1. Click the smart tag to open the C1TreeView Tasks menu. Select Edit TreeView.

    The C1TreeView Designer Form dialog box opens.

  2. Click the Add Child Item button   to add a C1TreeViewNode to the C1TreeView control.
  3. Click OK to close the C1TreeView Design Form dialog box.

In Source View

Add the following markup between the <cc1:C1TreeView> tags:

Markup
Copy Code
<cc1:C1TreeViewNode ID="Node1" runat="server" Text="Node1">
</cc1:C1TreeViewNode>

In Code View

Complete the following steps:

  1. Import the following namespace into your project:

    To write the code in Visual Basic:

    Visual Basic
    Copy Code
    Imports C1.Web.Wijmo.Controls.C1TreeView

    To write the code in C#:

    C#
    Copy Code
    using C1.Web.Wijmo.Controls.C1TreeView;
  2. Add the following code to the Page_Load event:

    To write the code in Visual Basic:

    Visual Basic
    Copy Code
    Dim TreeViewNode1 As New C1TreeViewNode()
    C1TreeViewNode1.Text = "C1TreeViewNode1"
    C1TreeView1.Nodes.Add(C1TreeViewNode1)

    To write the code in C#:

    C#
    Copy Code
    C1TreeViewNode TreeViewNode1 = new C1TreeViewNode();
    C1TreeViewNode1.Text = "C1TreeViewNode1";
    C1TreeView1.Nodes.Add(C1TreeViewNode1);
  3. Run the program.
See Also