1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / PageNode to PageSiteNode

PageNode to PageSiteNode

4 posts, 0 answered
  1. Conrad Ehinger
    Conrad Ehinger avatar
    59 posts
    Registered:
    22 Sep 2009
    12 Aug 2011
    Link to this post
    Here's my issue...

    I'm trying to print navigation based off of PageSiteNodes instead of SiteMapNodes. Before you suggest against it, here is why:

    In my code, I am using the API to find a PageNode based off of a PageId that is selected by the end-user:
    App.WorkWith().Page(PageId).Get();

    In my opinion, PageId is the only way you should do a search. I know I can find a PageSiteNode or SiteMapNode by searching by the Title or UrlName. I'm looking for a more exact approach. I have worked with sites where the Title and even UrlName may be the same (Same page under different sections). Anyways - I'm trying to come up with a solution to turn my PageNode into a PageSiteNode so that I can access children and parent nodes.

    This is for a control in the marketplace. When providing a solution - please don't suggest that I match by Title or UrlName. The solution I'm looking for is to match by PageId - which both PageSiteNode and PageNode have.

    Thanks!
  2. readonlychild
    readonlychild avatar
    67 posts
    Registered:
    26 May 2011
    12 Aug 2011
    Link to this post
    you may get what you need with

    PageNode pn = PageManager.GetManager().GetPageNode(new Guid(userPageId));

    or
    PageNode pn2 = PageManager.GetManager().GetPageData(new Guid(userPageId)).NavigationNode;
    if the Id is from a PageData object... The PageNode object has a .Nodes collection of children as if you were navigating the Page Hierarchy
  3. Conrad Ehinger
    Conrad Ehinger avatar
    59 posts
    Registered:
    22 Sep 2009
    12 Aug 2011
    Link to this post
    readonly - that is actually the opposite direction I'm looking to go.

    I want to get a PageNode (or Page or PageData) from a PageSiteNode.
  4. Antoine
    Antoine avatar
    45 posts
    Registered:
    13 Jul 2012
    16 Aug 2011
    Link to this post
    I needed to get the PageData so that I could pull the description (the description used to be available from the PageSiteNode itself before 4.2).  This worked for me:

    PageNode pageNode = App.WorkWith().Page(pageSiteNode.Id).Get();
    desc.Text = pageNode.Page.Description;
4 posts, 0 answered