Home - Forums-.NET - FlyTreeView (ASP.NET) - Setting SelectedNode and PopulateOnDemand

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

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

Setting SelectedNode and PopulateOnDemand
Link Posted: 10-Jan-2007 08:05
I'm having a problem where I add many new nodes and I want to make one of these new nodes the selected node.

The sequence is:
1) User selects a node from FlyTreeView.
2) I create the new entities in the Database.
3) I reload the FlyTreeView from the Database.
4) I recursively search for the FlyTreeNode that I want to be selected.

The problem is that the tree is built using PopulateOnDemand, so when I'm doing the recursive search, I immediately return, because the top node hasn't had the ..._PopulateNodes event fired yet.

Also, the node I want to select, lives below the expandlevel.

It seems like the only solution is to get rid of PopulateOnDemand, but then it's way to slow.

Any ideas?
Link Posted: 10-Jan-2007 10:46
I do not completely understand your idea.

2) I create the new entities in the Database.

What entries do you create? How are they related to FlyTreeView nodes?

3) I reload the FlyTreeView from the Database.

I think that in this place you can load only expanded part of the treeview. Other nodes can use PopulateOnDemand

4) I recursively search for the FlyTreeNode that I want to be selected.

Do you need to restore previously selected node. Or what is the criteria for the search?

I believe there's always an option to use load-on-demand in various cases. Your one does not look like exception.