New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

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.

 

NameParametersReturn TypeDescription
addNavigationNodenoneAdds a child node to the collection. See Example 1.
insertint, NavigationNodenoneInserts the node into the collection at the position defined by the first (index) parameter. See Example 2.
getNodeintNavigationNodeReturns the item from the collection that resides at the specified index. See Example 3.
indexOfNavigationNodeintReturns the index of a node. See Example 4.
get_countnoneintReturns the number of nodes in the collection. See Example 5.
getFirstNodenoneNavigationNodeReturns the first node in the collection. See Example 6.
getLastNodenoneNavigationNodeReturns the last node in the collection. See Example 7.

Example 1: Add a child node to the collection.

JavaScript
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.

JavaScript
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.

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

Example 4: Return the node's index.

JavaScript
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.

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

Example 6: Return the first node in the collection.

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

Example 7: Return the last node in the collection.

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

See Also

In this article
See Also
Not finding the help you need?
Contact Support