Hi,
I'm having some performance issues with the treeList control. I am populating it in virtual mode using the following events:
protected void treeList_VirtualModeCreateChildren(object sender, TreeListVirtualModeCreateChildrenEventArgs e)
{
Explorer explorer = (Explorer)e.NodeObject;
int? id = explorer == null ? (int?) null : explorer.ID;
e.Children = BGI.ExplorerData.Get(id);
}
protected void treeList_VirtualModeNodeCreating(object sender, TreeListVirtualModeNodeCreatingEventArgs e)
{
Explorer explorer = (Explorer)e.NodeObject;
e.NodeKeyValue = explorer.ID;
e.IsLeaf = explorer.IsLeaf;
e.SetNodeValue("node", explorer.Node);
e.SetNodeValue("dtd_tot_base", explorer.Daily);
e.SetNodeValue("mtd_tot_base", explorer.MTD);
e.SetNodeValue("ytd_tot_base", explorer.YTD);
}
Explorer is just a class which is used to contain a single item of data.
ExplorerData.Get is a static method which queries the database and retrieves a sqlDataReader and then populates it into a List of Explorer classes.
I've noticed that treeList_VirtualModeCreateChildren gets called for every opened node in the control. This does not seem right to me as I would expect it to just query the latest. Am I doing something wrong here? It does not seem right that it would have to build the entire tree each time and not just the new bits?
Any help would be greatfully received. Or indeed any other advice for improving performance.
Thanks in advance
Corun