ComponentOne TreeView for ASP.NET WebForms
TreeView Creation / Static Creation
In This Topic
    Static Creation
    In This Topic

    Each node in the Tree is represented by a name/value pair, defined by the text and value properties of treenode, repectively. The text of a node is rendered, whereas the value of a node is not rendered and is typically used as additional data for handling postback events.

    A static menu is the simplest way to create the treeview structure.

    You can use the TreeView Designer Form designer to build the treeview system or you can use declarative syntax in the .aspx file to specify the nodes.

    To display static C1TreeViewNodes using the designer, open the TreeView Designer Form and add C1TreeViewNodes to the parent. The properties for each C1TreeViewNode can be modified directly in the designer. For more information about the menu designer, see TreeView Designer Form.

    To display static C1TreeViewNodes using declarative syntax, first nest opening and closing <Nodes> tags between opening and closing tags of the C1TreeView control. Next, create the treeview structure by nesting <asp:C1TreeViewNode> elements between opening and closing <Nodes> tags. Each <asp:C1TreeViewNode> element represents a node in the control and maps to a C1TreeViewNode object.

    Declarative syntax can be used to define the C1TreeViewNodes inline on your page.

    For example:

    Syntax
    Copy Code
    <cc1:C1TreeView ID="C1TreeView1" runat="server" AllowSorting="False" AutoCollapse="False" VisualStyle="Default" VisualStylePath="~/C1WebControls/C1TreeView/VisualStyles">
                <Nodes>
                    <cc1:C1TreeViewNode runat="server" Expanded="False" Text="C1TreeViewNode">
                        <Nodes>
                            <cc1:C1TreeViewNode runat="server" Expanded="False" Text="C1TreeViewNode">
                            </cc1:C1TreeViewNode>
                            <cc1:C1TreeViewNode runat="server" Expanded="False" Text="C1TreeViewNode">
                            </cc1:C1TreeViewNode>
                            <cc1:C1TreeViewNode runat="server" Expanded="False" Text="C1TreeViewNode">
                                <Nodes>
                                    <cc1:C1TreeViewNode runat="server" Expanded="False" Text="C1TreeViewNode">
                                    </cc1:C1TreeViewNode>
                                    <cc1:C1TreeViewNode runat="server" Expanded="False" Text="C1TreeViewNode">
                                    </cc1:C1TreeViewNode>
                                    <cc1:C1TreeViewNode runat="server" Expanded="False" Text="C1TreeViewNode">
                                    </cc1:C1TreeViewNode>
                                </Nodes>
                            </cc1:C1TreeViewNode>
                        </Nodes>
                    </cc1:C1TreeViewNode>
                </Nodes>
            </cc1:C1TreeView>
    
    See Also