PageData querying page properties

Posted by Community Admin on 04-Aug-2018 20:43

PageData querying page properties

All Replies

Posted by Community Admin on 15-Jun-2011 00:00

Hi, using the fluent API to get a page object:

 PageManager pageManager = PageManager.GetManager();
    PageData page = pageManager.GetPageDataList().Where(pD=> pD.Title == title).FirstOrDefault();
    return page;

how do I then retrieve properties such as the 'show in navigation', or any of those advanced properties for that matter. Can't find them anywhere if I inspect that object.

Also, I'm using the above by taking the SiteMapNode.Title and finding its corresponding Sitefinity page, but it seems risky as you can have many pages named the same. Is it easier to make the connection between a SiteMapNode and a Page object? SiteMapNode has a property of Key with is a Guid. but this isnt the same as the Page Guid is it?

Thanks

Posted by Community Admin on 16-Jun-2011 00:00

Hi Pepperio,

Thank you for contacting Sitefinity Support!

There are two important abstractions behind each Sitefinity page - 'Page Node' and 'Page Data':

  • The 'Page Data' object contains the content of the page - html, asp.net controls and etc.
  • Sitefinity uses 'Pages Nodes' for the organization - just like a hierarchical taxonomy. When a page is created, it should be attached to some 'Page Node'.

The code below shows how to access the PageData and the PageNode objects associated with given page(via the Native API):
var pageManager = PageManager.GetManager();
var siteMapNode = SiteMapBase.GetActualCurrentNode();
 
var pageNode = pageManager.GetPageNode(siteMapNode.Id);
var pageData = pageManager.GetPageData(siteMapNode.PageId);
 
//Check whether the page ought to be displayed in the navigation controls
bool showInNavigation = pageNode.ShowInNavigation;

p.s. siteMapNode.Id is the ID of the associated PageNode object and siteMapNode.PageId is the ID of the associated PageData object

Best wishes,
Tihomir
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed