I've been playing around with the RadTreeView control to bind it to custom business objects using a custom implemented IHierarchicalDataSource. I have found a sample data source control in the Telerik forums that shows the directory/file structure of the website (forum article: http://www.telerik.com/community/forums/aspnet/treeview/treeview-binding-to-business-object.aspx#274329; sample code: http://msdn.microsoft.com/en-us/library/system.web.ui.hierarchicaldatasourcecontrol.aspx).
The issue I'm having is to implement a true 'load on demand' with the RadTreeView. If I use the sample code for the HierarchicalDataSource provided by Microsoft using the standard ASP.NET Treeview control, the 'load on demand' occurs appropriate: only when child nodes are required from a client-expand, the child-nodes are actually loaded on the server (you can check this by e.g. setting a break-point in the 'Select' method of the 'FileSystemDataSourceView'.
The code I'm using for this:
<demo:FileSystemDataSource ID="FileSystemDataSource1" runat="server"></demo:FileSystemDataSource>
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="FileSystemDataSource1" ExpandDepth="0"></asp:TreeView>
Please note that the ExpandDepth must be set to '0' and not 'FullyExpand': I only want to load the nodes that the user requests, because in my case there can be hundreds, even thousands of nodes.
Now, when I change the ASP.NET Treeview into a RadTreeView, all childs are loaded with all children (so, recursive which returns the full hierarchical structure) on the first hit to the page (as if a FullyExpand is required). You can check this by setting a break-point in the GetChildren method of the 'FileSystemHierarchyData'.
The code used for this approach:
<demo:FileSystemDataSource ID="FileSystemDataSource1" runat="server"></demo:FileSystemDataSource>
<telerik:RadTreeView ID="RadTreeView1" Runat="server" DataSourceID="FileSystemDataSource1"></telerik:RadTreeView>
Using a structure as shown below is a real performance killer, which isn't the case when using the standard ASP.NET Treeview control:
Top_1
Level 1_1
Level 1_1_1
Level 1_1_2
...
Level 1_1_50
Level 1_2
Level 1_2_1
Level 1_2_2
...
Level 1_2_50
...
Level 1_50
Level 1_50_1
Level 1_50_2
...
Level 1_50_50
Top_2
Level 2_1
....
Level 2_50_50
I've tried to change the properties of the RadTreeView to modify this behavior, but with no success.
Am I missing something here? Any suggestions?
As a side-question: can the RadTreeView handle in a proper manner lets say a thousand child nodes for one given parent?
Thanks
Hans