Home - Forums-.NET - FlyTreeView (ASP.NET) - Is there any way to optimize?

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

Is there any way to optimize?
Link Posted: 28-Mar-2008 03:39
The datatable contain 1800 rows and databinding is taking 7sec on localhost. Is there any way to optimize this code?


hierarchicalData = NineRays.WebControls.FlyTreeView.ConvertTabularDataToHierarchical(dataset, "TableName", "NodeID", "OwnerID")
                        ' Bind the treeview
                        TV.DataSource = hierarchicalData
                        TV.DataBind()
Link Posted: 28-Mar-2008 04:32
What actual line causes 7sec delay? DataBind? Or ConvertTabularDataToHierarchical?
There was an update in January that affects large treeviews performance.
Also, it will take much time for the browser to render large amount of nodes.
Best solution is to load nodes on expand.
Link Posted: 30-Mar-2008 20:01
The databind gets that delay

Ok regarding your suggestion for populating on expand i have some question:
How i populate treeview right now is that a stored procedure getting all the data for Treeview in the form of a table and i have bind it with treeview using ConvertTabularDataToHierarchical.
     Can you brief tell me how i have to populate on expand?
     Will the treeview cache the whole data and then load it on expand?
     Or I have to explicitly get the data each time using filter criteria?
Link Posted: 30-Mar-2008 20:39
From my point of view, you do not need to use the ConvertTabularDataToHierarchical.
Instead, for every branch you can simply create nodes from records in your DB that has required parent key.

For example, you can store key of node in the node.Value field. So next time, when you receive the PopulateNodes event you can simply get the
string parentID = e.Node.Value;
and then select only required data from your datatable (using fast ADO filtering) and add nodes to e.Node.ChildNodes collection one by one (databinding will not work for tabular data).