PageNode returns nothing
Hello,
I am developing an application with Sitefinity 4.1 SP2. There is a scenario where I have to get Page Details so i m using GetPAgeNodes() method of PageNode class with below code
PageNode pga = pageManager.GetPageNodes().Where(pD => pD.Title == currentAccessedPage).FirstOrDefault();
But the above code returns NULL. I have tried with UrlName, Title and other varous ways but no luck. Nothing returns. Have gone through the existing threads of Sitefinity forum. Above method was mentioned most of time in your forums. I have also tried with fluent API, it does not return anything.
Please help me out in this situation and how to get page details as we need to have PageId of requested Page so that we can have information for assigned permissions and Roles.
Waiting for your response as early as possible
Thanks
Fareed Khan
Hi Fareed,
Please take a look at the below examples showing how you can properly access the page details using Fluent API.
var fluent = App.WorkWith().Pages();
//get a page by its Title
var mypage = fluent.LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend)
.Where(p => p.Page.Title ==
"Test"
).Get().FirstOrDefault();
//get the id of that page
var pageId = mypage.Id;
//get a list of pageNodes
var pageNodes = App.WorkWith().Pages().Get().ToList();
foreach
(var p
in
pageNodes)
//get the node id
var nodeId = p.Id;
//get the id of the page in that node
var myPageId = p.Page.Id;
//get the page UrlName
var myPageUrlName = p.Page.UrlName;
//etc..