Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
WebDataTree- Find a specific Node
posted

Hi,

 

I am upgrading from UltraWebTree to WebDataTree.

In UltraWebTree, has Find method to find node with specific Tag as shown below

 

Node

 

parentNode = treeMap.Find(menuItem.ParentId);

 

Where menuItem.ParentID is set as Tag property of the Node.

 as shown:

Node newNode = new Node();

 newNode.Text = menuItem.MenuText;

 newNode.Tag = menuItem.MenuId;

 

But in WedDataTree, I am not able to see Find method so I was using FindNodeByValue. But this method returns only root level node collection. I am binding tree with an object in code behind. I am able to populate root node but not able to add child node at specific location. Please let me know what is replacement of Find method in WebDataTree.

 

Please help its very urgent

 

Amar

Parents
  • 17590
    Offline posted

    Hello Amarjeet,

    Thank you for posting in our community.

    What I can suggest for replacing the Find method form UltraWebTree is using FindNodeByKey. For example :

    this.WebDataTree1.Nodes.FindNodeByKey("ParentNode1");

    Please note that FindNodeByKey will only return the node on the specific collection on which you called the method.

    In order to find a specific node based on its key in the complete list of nodes in the tree you can use AllNodes property which will return an array list with all nodes in the tree in depth-first order. You can loop in that collection and check the related Key of each code. For example:

    ArrayList nodesList = WebDataTree1.AllNodes;

    for(int i=0; i<nodesList.Count; i++)

    {

    if (((Infragistics.Web.UI.NavigationControls.NavItem)(nodesList[i])).Key == "ChildNode1.2")

    {

    //your code here

    }

    }

    I hope you find this information helpful.

    Please let me know if you need any further assistance with this matter.

Reply Children
No Data