A good way to use the Treeview control in Asp.net to achieve unlimited Classification

Source: Internet
Author: User
Recently, I wrote an infinitely hierarchical table using the Treeview control. ProgramI checked a lot of information on the Internet, most of which were recursive call methods. I thought it was very complicated. Later, I accidentally looked at msdn and referred to it. I thought it was the best solution. When I said it, you would suddenly become open-minded. In the reeview event, a treenodepopulate event is triggered when the treenode is being filled. Write the event Method to read the corresponding sub-node content from the database. Note that you must set the populateondemand attribute of the node to true when filling the node dynamically:
Treenode Tn = new treenode ();
Tn. Text = Dr ["orgname"]. tostring ();
Tn. populateondemand = true;
Treeview1.nodes. Add (TN );
In this way, the added node will trigger the treenodepopulate event.
As for the details, it is not the scope of this indicator. I will not elaborate on the specific msdn examples.
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.