ASP. NET-how to: add or delete Treeview node Elements

Source: Internet
Author: User

You can create a node for the Treeview control statically-that is, it is created at design time. This method is useful if you want to create a tree with fixed items.

Note: you cannot define nodes in static mode or bind data to the Treeview control.

 

1. Add a node to the Treeview Control

1. In the design view, right-click the Treeview control and click Edit node ".

2. Under "Node" in "Treeview node Editor", click "add root node.

3. In the "attribute" grid, configure nodes by setting attribute values. Typical attributes to be set include:

· Expanded: Specifies whether the node is enabled by default.

· Text indicates the text displayed on the node.

· One Of The selectaction values specifies the conditions that occur when a user clicks a node.

4. To create a subnode, select the parent node in the "Treeview node Editor" and click the "add subnode" button.

5. After the node is created, click OK ".

 

2. delete a node from the Treeview Control

1. In the design view, right-click the Treeview control and click Edit node ". The "Treeview node Editor" is displayed ".

2. Under "Node" in the "Treeview node Editor", select the node you want to delete and click the "Remove node" button.

Note that when a node is deleted, all the child nodes of the node are also deleted. After the node is deleted, click OK ".

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.