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
- Bind WebTreeView to XMLDataSource.
Please use Desktop.xml as the XMLDataSource's file. You can find
Desktop.xml in LiveSample's AppData folder.
- Drag HTML TextBox, Button and div controls to the WebForm.
- 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.
- Set TextBox's ID to txtPath and the div's ID to divWebTreeViewNode.
- Implement onclick client side event for the HTML Button like following:
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";
}
}
|
- 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.