views:

64

answers:

2

I'm binding a lot of data to a TreeView control as the data is a natural category hierarchy. The problem is that there is a lot of it. I have managed to remove a lot of the overhead by only binding those nodes which appear in the visible tree, but this still leaves a lot in the ViewState, et al.

Does anyone have a method or alternative control for improving this kind of performance issue, please?

I was thinking about trying to inherit the TreeView control and dump it's viewstate value into Sesssion and back - but it's quite a hack I don't really have time for, right now...

Thanks,

Matt.

+2  A: 

Yes ... you can use On-demand Loading or Lazy loading of Tree View Items

i.e.

1- Only show root level nodes as in the Window Explorer.

2- when user Clicks a node , than only fetch the child nodes and show.

in this way , you will see only those nodes which actually user requested.

and you can give a checbox , which say 'SHOW WHOLE TREE EXPANDED' obviously , it would take more time to show.

you can also implement Node search functionality but please remember tree is specilized form a graph so use proper grpah algorithm while finding a node like (BFS or DFS)

you can also cache the results of nodes but this should be only done in the case when your tree itself is not used for hierarchy updation.

saurabh
Thanks, but this is what the code is already doing, and still generating quite a bit of viewstate!
Matt W
A: 

apart from the solution of dynamically loading tree view on expand, try ViewStateCompression for viewstate enhancement, use Asp.net Caching for output caching or just cache the objects by dynamically adding objects to cache using generating keys like "tree_" & parent. Cache objects are shared between sessions, so it will even be more helpful. Hope this will help.

lakhlaniprashant.blogspot.com