Dynamically increasing nodes in the TreeView of ASP.net 2.0
Source: Internet
Author: User
asp.net|treeview| dynamic in asp.net 2.0, to dynamically extract content from the database, dynamically add nodes, it is not difficult, for example, in the pubs database of SQL SERVER 2000 as an example, to the tree-type list, to take out the author, as the root node, And then take out what each author has written, as a child node, you can
Note that the Ontreenodepopulate event occurs when the node of the tree is expanded, where the custom node_populate is defined, and in node_populate, the depth of the current node is checked, and if 0 is the root node, So call the fillauthors process, take out all the authors, if the depth is 1, is the leaf node, call the filltitlesforauthors process. Among them, we should pay attention to the dynamic establishment of tree nodes in their process, such as:
TreeNode NewNode = new TreeNode (row["au_fname"). ToString () + "" +
row["au_lname"]. ToString (),
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