Edit this page

RadNavigation Object

The following table lists the most important of the RadNavigation object's client-side methods:

 

Name Parameters Return Type Description
get_enabled none boolean True if the navigation is enabled.
set_enabled Boolean none Enables/disables the navigation.
findNodeByText (string text) NavigationNode Returns the first NavigationNode object whose Text property is equal to the passed parameter.
findNodeByUrl (string URL) NavigationNode Returns the first NavigationNode object whose NavigateUrl property is equal to the passed parameter.
get_nodes none NavigationNodeCollection Returns the collection of root level nodes. See Example 1.
get_allNodes none Array Gets a linear collection of all nodes. This includes all root and child nodes in the navigation. See Example 2.
focus none none Brings the focus to the first Navigation node.
get_expandedNode none NavigationNode Returns the expanded root level node. If no node is expanded at the root level returns null.
get_selectedNode none NavigationNode Returns the selected Navigation node. If no node is selected returns null.
get_firstNode none NavigationNode Returns the first Navigation node. If the Navigation does not contain nodes returns null.
get_element none HTML Element Gets the DOM element for the Navigation (div). See Example 3.
get_childListElement none HTML Element Gets the DOM element for the list of nodes in the navigation (UL).
add_EventName (mixed eventHandler) none Attaches an eventHandler to the event with the name <EventName>. See Example 4.
remove_EventName (mixed eventHandler) none Detaches an eventHandler from the event with the name <EventName>. See Example 5.
expandMenuButton none none Expands the Navigation Menu Button, showing the nodes it contains in a dropdown. See Example 6.
collapseMenuButton none none Collapses the Navigation Menu Button, hiding the expanded nodes. See Example 7.
get_visible none Boolean True if the navigation is visible, false otherwise.
set_visible Boolean none Sets the Navigation's visibility.
set_minWidth integer none Sets the screen width under which all nodes are hidden. See Controlling the Point of Collapsing All Nodes.

Example 1: Get a collection of the root level nodes.

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

Example 2: Get a linear collection of all nodes.

var nav = $find("<%= RadNavigation1.ClientID %>");
var allnodes = nav.get_allNodes()   

Example 3: Hide/show the Navigation.

// hide the Navigation
// note this change does not persist after a postback
function hideNavigation()
{  
    var nav = $find("<%= RadNavigation1.ClientID %>");
    nav.get_element().style.display = "none";
}

// show the Navigation
function showNavigation()
{  
    var nav = $find("<%= RadNavigation1.ClientID %>"); 
    nav.get_element().style.display = "";
}       

Example 4: Attach an OnClientNodeClicked event handler.

function OnClientNodeClicked(sender, args) {
    alert("clicked");
}

function AttachClickHandler()
{   
    var nav = $find("<%= RadNavigation1.ClientID %>"); 
    nav.add_nodeClicked(OnClientNodeClicked);
}       

Example 5: Remove the OnClientNodeClicked handler.

function OnClientNodeClicked(sender, args) {
    alert("clicked");
}

function RemoveClickHandler()
{   
    var nav = $find("<%= RadNavigation1.ClientID %>"); 
    nav.remove_nodeClicked(OnClientNodeClicked);
}       

Example 6: Expand the Navigation Menu Button.

function ExpandMenuButton()
{   
    var nav = $find("<%= RadNavigation1.ClientID %>"); 
    nav.expandMenuButton();
}       

Example 7: Collapse the Navigation Menu Button.

function CollapseMenuButton()
{   
    var nav = $find("<%= RadNavigation1.ClientID %>"); 
    nav.collapseMenuButton();
}       

See Also