TreeView大数据量绑定的优化方案(the Plenty of data issue of ASP.NET TreeView)

In that scenario, I have some suggestions:
 
First, please try to keep the node number of TreeView less than 1000, we can find that advice there:
 
http://msdn.microsoft.com/en-us/library/ms529261.aspx
Rendering enormous hierarchical data sets in a single TreeView data island is not recommended. As a general rule, try to keep the number of nodes in a tree under 1000.
 
Each time an update is made to the UI of a TreeView control, for example, whenever a node is expanded or collapsed, additional data is appended to the view state, which maintains a history of state changes in the Web page. This means that each time a view is updated with a large data island, the amount of data appended to the view state history is increased. In ASP.NET, there is a limit in the size of the view state, so the combination of very large tree hierarchies combined with multiple updates may cause performance problems, and in certain cases portions of the history could be lost.


 
 
Second, if the rendered page is too large, I would like to suggest you try the ASP.NET 2.0 CSS Friendly Control Adapters, just like the following picture shows, it can optimize the rendering of the TreeView control:


 
 
Third, we can use AJAX to bind the Tree Node dynamically on demand; I think it can resolve the Plenty of data issue of TreeView:
 
 
There are some good article and samples about AJAX TreeView:
 
Building Tree View on demand using AJAX
http://www.codeproject.com/KB/aspnet/TreeViewAjax.aspx
 
Ajax TreeView
http://codeclimber.net.nz/archive/2007/06/28/Ajax-TreeView.aspx
 
Treeview AJAX Control sample page
http://www.mathertel.de/AJAXEngine/S03_AJAXControls/TreeView.aspx
 
DHTML Tree View of Arbitrary Depth using AJAX
http://www.codeproject.com/KB/aspnet/ajax_treeview.aspx
 
If I’ve misunderstood the facing issue, please feel free to let me know.
 
Thanks.

posted @ 2008-08-29 17:41  LanceZhang  阅读(2391)  评论(0编辑  收藏  举报