Click here to Skip to main content
15,900,818 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi friends,
I am using treeview in my project to load data from database.
As data is to much in that case page take time to load.
Is there any way to use paging in TreeView??

Or is there any way to load innitial data on page load in beging and rest load in background so page should be load fast...???

What I have tried:

currently i am lading all data on page load
Posted
Updated 2-Aug-17 4:15am
v2
Comments
Richard Deeming 1-Aug-17 14:51pm    
You've tagged this as MVC, but as far as I can see MVC doesn't include a built-in TreeView. You're going to need to tell us which TreeView library you're using.
j snooze 1-Aug-17 17:09pm    
Not that i know what your project is, but a paging treeview doesn't exactly sound like an intuitive interface to give a user. Treeviews a great for folder like level/sublevel structure, but if there is too much data, it sounds like you would need to add sorting or search capability because who wants to painstakingly look for levels upon levels of data? Just my thoughts.
Graeme_Grant 1-Aug-17 21:36pm    
Do you mean "Load on Demand" child nodes???
Kornfeld Eliyahu Peter 2-Aug-17 7:14am    
ASP.NET tree view does not support paging (the reason probably, because it very hard to implement visually, as you are at some hierarchical data)... Think about PopulateOnDemand... https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treenode.populateondemand.aspx

Perhaps you can put some Hyperlinks under the TreeView control, the Hyperlinks has the URL like
<a id="hyperlink1" href="?page=1" runat="server">page 1</a>
,
the Hyperlink should be dynamically added to a placeholder control. And according to the different query
string page, you can populate the TreeView control with different data.

Here is a Microsoft web resource which introduces the TreeView control, please refer to the URL below.
http://msdn.microsoft.com/en-us/library/e8z5184w(VS.80).aspx
 
Share this answer
 
I have also experience same issue. Then what I do was, for the very first time keep all nodes close and only query to SQL for root nodes that needs to be display, after wards when click on particular node, I make query for that node ID and popular its child nodes. In short, I was loading child nodes from database, on clicking on parent node, by using parent node ID.

Hope it will helpful for you, please don't forget to mark my good rating. Thanks :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900