简体   繁体   English

asp.net异步树状视图

[英]asp.net async treeview

I am trying to build a dynamic treeview which is populated when the user clicks on one of the pluses. 我试图建立一个动态的树视图,当用户单击其中一个加号时将填充该树视图。 on my database I have records which work like parent and child, so a record has link to its parent record and link to all its child records (I think the way the database works is not relevant so im not going to explain). 在我的数据库中,我有像父母和孩子一样工作的记录,因此一条记录具有与其父记录的链接以及与其所有子记录的链接(我认为数据库的工作方式无关紧要,因此我将不作解释)。 The issue is some of the records may have upto 1000000 child records and as you can see loading all of them at once can cause some issues as you may be loading millions of nodes at once. 问题是某些记录可能具有多达1000000个子记录,并且如您所见,一次加载所有记录可能会导致一些问题,因为您可能一次加载数百万个节点。

so I was wondering if any one had some goof tutorials on treeviews. 所以我想知道是否有人在树视图上有一些愚蠢的教程。

1 - Set the TreeView.ExpandDepth to 0 . 1-将TreeView.ExpandDepth设置为0 This eliminates the expansion of the added TreeNode objects in the TreeView and shows the expansion symbol [+] next to each TreeNode that has the TreeNode.PopulateOnDemand property set to true. 这消除了TreeView中添加的TreeNode对象的扩展,并在每个TreeNode.PopulateOnDemand属性设置为true的TreeNode旁边显示扩展符号[+]。

2- Set the TreeNode.PopulateOnDemand to True for each branch TreeNode. 2-将每个分支TreeNode的TreeNode.PopulateOnDemand设置为True When the TreeNode.ChildNodes collection is empty, the expansion symbol [+] will be showed only next to TreeNode objects that has TreeNode.PopulateOnDemand property set to true . TreeNode.ChildNodes集合为空时,扩展符号[+]将仅在TreeNode.PopulateOnDemand属性设置为true TreeNode对象旁边显示。

3- Handle the TreeView.TreeNodePopulate event to poulate branch nodes on expansion. 3-处理TreeView.TreeNodePopulate事件以在扩展时填充分支节点。 This event will be fired when a TreeNode - with the TreeNode.PopulateOnDemand set to true - has been expanded right before the TreeView.TreeNodeExpanded event gets fired. TreeNode.PopulateOnDemand设置为trueTreeNode.PopulateOnDemand刚在触发TreeView.TreeNodeExpanded事件之前展开时,将触发此事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM