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 @   LanceZhang  阅读(2398)  评论(0编辑  收藏  举报
编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· [AI/GPT/综述] AI Agent的设计模式综述
点击右上角即可分享
微信分享提示