After getting the client-side instance of the treeview object, you can use its nodes collection to directly access the nodes on the client -side. Also, you can find certain nodes by their text or value and select them. To select a node, you should use the Select() method. You can simply highlight a node by using the Highlight() method.
The example below shows how to select the first node of the nodes collection upon a button-click. The second button fires a JS function that selects a certain node ("NeededNode").
Example:
| ASPX |
Copy Code |
|
<script language="javascript" type="text/javascript"> function SelectFirstNode() { var treeView = <%=RadTreeView1.ClientID >; selecting the first node in the nodes collection=RadTreeView1.ClientID %>; //find certain node by text and then select it var node = treeView.FindNodeByText("NeededNode"); node.Select(); } </script>
<rad:radtreeview id="RadTreeView1" runat="server" ... />
<input id="Button1" type="button" value="button" onclick="SelectFirstNode()" />
<input id="Button1" type="button" value="button" onclick="SelectCertainNode()" /> |
See Also