More in this section

Forums / Developing with Sitefinity / Getting the ID of the root menu item?

Getting the ID of the root menu item?

2 posts, 1 answered
  1. Steve
    Steve avatar
    3037 posts
    03 Dec 2008
    28 Feb 2010
    Link to this post
    How do I go about getting the ID of the root menu item of a page I'm on?  I want to do a GetPages on it to get all children...

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    28 Feb 2010
    Link to this post
    Hi Steve,

    Here is a sample that illustrates how to get the current item and then the root item of your RadMenu control

    CmsSiteMapNode currentNode = SiteMap.CurrentNode as CmsSiteMapNode;
    while (currentNode != null && currentNode.ParentNode != null)
        if (currentNode.ParentNode != SiteMap.RootNode)
            currentNode = (CmsSiteMapNode)currentNode.ParentNode;
    RadMenuItem menuItem = this.RadMenu1.FindItemByUrl(this.ResolveUrl(currentNode.Url).ToString());
    if (menuItem != null)
       // here menuItem is the root item.

    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
2 posts, 1 answered