Intersoft Support Center

Find Node by Path

WebTreeView gives you a way to find the node by path.

In this topic, you will learn how to find node by path.

To find node by path

  1. Bind WebTreeView to XMLDataSource. Please use Desktop.xml as the XMLDataSource's file. You can find Desktop.xml in LiveSample's AppData folder.
  2. Drag HTML TextBox, Button and div controls to the WebForm.
  3. TextBox is used to specify the path, Button is used to find the node in WebTreeView and select the node, and div is used to specify the finding information whether the node is found or not.
  4. Set TextBox's ID to txtPath and the div's ID to divWebTreeViewNode.
  5. Implement onclick client side event for the HTML Button like following:

    JavaScript Copy ImageCopy Code
    function Button1_onclick()
    {   
       var tv = ISGetObject("WebTreeView1");   
       var node = tv.FindNodeByPath(document.getElementById("txtPath").value);   
       var divStatus = document.getElementById("divWebTreeView1Node");   
       divStatus.innerHTML = "";   
       if (node!=null)   
       {      
          node.Select();      
          divStatus.innerHTML = "Node is found
    
    Node name : " + node.Name; } else { divStatus.innerHTML = "Node is not found"; } }

  6. Try to specify the TextBox with "Desktop/My Documents" and click the button. For more information, please refer to Find Node by Path sample in  Live Samples >> WebTreeView >> Client Programmability.
Previous Next