Home - Forums-.NET - FlyTreeView (ASP.NET) - serverside check if new node allready excists

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

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

serverside check if new node allready excists
Link Posted: 15-Oct-2006 22:25
When adding a new node serverside, I want to check first if it allready excists somewhere in the tree. I think the findAll method will do the trick: empty array if it does not excist but how do I get it to work? How to I build the predicate parameter? Do you have a sample?
Link Posted: 15-Oct-2006 23:55
For example the following implementation to find all nodes having required Text.

string requiredText = \"John Smith\";
FlyTreeNodeCollection foundNodes = myFlyTreeView.FindAll(delegate(FlyTreeNode match)
    {
        return match.Text == requiredText;
    });


But you may also be interested in FlyTreeView.Find(..) (or FlyTreeNodeCollection.Find(..)) method that returns the first occurrence of the node that matches conditions defined by the specified predicate. Otherwise it returns null. It is generally faster in runtime because it does not loop through the entire collection (when it already found required node).
Link Posted: 16-Oct-2006 01:02
thanx! Works like a charm.