Edit this page

NavigationNodeCollection Object

The NavigationNodeCollection object is returned by the get_nodes method of the RadNavigation object or the NavigationNode object. The following table lists the most important methods.

 

Name Parameters Return Type Description
add NavigationNode none Adds a child node to the collection. See Example 1.
insert int, NavigationNode none Inserts the node into the collection at the position defined by the first (index) parameter. See Example 2.
getNode int NavigationNode Returns the item from the collection that resides at the specified index. See Example 3.
indexOf NavigationNode int Returns the index of a node. See Example 4.
get_count none int Returns the number of nodes in the collection. See Example 5.
getFirstNode none NavigationNode Returns the first node in the collection. See Example 6.
getLastNode none NavigationNode Returns the last node in the collection. See Example 7.

Example 1: Add a child node to the collection.

var nav = $find("<%= RadNavigation1.ClientID %>");
var nodes = nav.get_nodes();
var childNode = new Telerik.Web.UI.NavigationNode();
childNode.set_text("New");
nodes.add(childNode);       

Example 2: Insert a node into the collection at the specified index.

var nav = $find("<%= RadNavigation1.ClientID %>");
var nodes = nav.get_nodes();
var childNode = new Telerik.Web.UI.NavigationNode();
childNode.set_text("New");
nodes.insert(0, childNode);     

Example 3: Return the item at index 0 from the collection.

var nav = $find("<%= RadNavigation1.ClientID %>");
var node = nav.get_nodes().getNode(0);      

Example 4: Return the node's index.

var nav = $find("<%= RadNavigation1.ClientID %>");
var node = nav.get_nodes().getNode(1);
var index = nav.get_nodes().indexOf(node);  

Example 5: Return the number of nodes in the collection.

var nav = $find("<%= RadNavigation1.ClientID %>");
var count = nav.get_nodes().get_count();            

Example 6: Return the first node in the collection.

var nav = $find("<%= RadNavigation1.ClientID %>");
var node = nav.get_nodes().getFirstNode();          

Example 7: Return the last node in the collection.

var nav = $find("<%= RadNavigation1.ClientID %>");
var node = nav.get_nodes().getLastNode();       

See Also