More in this section

Forums / Developing with Sitefinity / Relative Location

Relative Location

2 posts, 0 answered
  1. Chris Schrader
    Chris Schrader avatar
    14 posts
    Registered:
    19 Feb 2010
    24 May 2010
    Link to this post
    I was wondering if there was a way for me to be able to figure out where I am in the system at all times, i.e. under the third node, two pages down.

    The issue is that our top node's name is changing from time to time, and we have to go into our controls and hard code the path to a file from oldNodeName\test.aspx to newNodeName\test.aspx. So if there was a way to just say (findMyPosition)\test.aspx, it would eliminate a lot of hassling/rebuilding of our application.

    Thank you for your attention.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    25 May 2010
    Link to this post
    Hi Chris Schrader,

    You could get the current page and identify the position in the SiteMap.

    sample code

    // get the page ID from the context.
     var id = this.Context.Items["cmspageid"];
     if (id != null)
     {
         Telerik.Cms.CmsManager mgr = new Telerik.Cms.CmsManager();
         Telerik.Cms.ICmsPage page = (Telerik.Cms.ICmsPage)mgr.GetPage(new Guid(id.ToString()));
         if (page != null)
         
     
     
          }
       }


    Sincerely yours,
    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, 0 answered