More in this section

Forums / Developing with Sitefinity / PageNode.Urls is empty

PageNode.Urls is empty

2 posts, 0 answered
  1. Keith
    Keith avatar
    2 posts
    Registered:
    01 May 2012
    25 May 2012
    Link to this post
    Using the Fluent API in Sitefinity 5.0 SP1, I'm just trying to get the url for a page to put in the href attribute of a link. I have a collection of PageNodes and I'm iterating over them. The PageNode.Url is always empty. Part of the problem might be that I'm getting the PageNodes by finding a parent page (titled "Careers") which is just a grouping page with no content. CareerLinkData is just a simple class with two string properties. I see references to a GetFullUrl() method in the forum, but it seems like it's not in Sitefinity anymore?

    private List<CareerLinkData> GetCareerPages()
    {
        List<CareerLinkData> results = new List<CareerLinkData>();
     
        var pageNodes = App.WorkWith().Pages().ThatArePublished().Where(pN => (pN.Page != null && pN.Parent.Title == "Careers")).Get();
     
        foreach (Telerik.Sitefinity.Pages.Model.PageNode pn in pageNodes)
        {
            results.Add(new CareerLinkData(pn.Urls.FirstOrDefault().Url, pn.Title));
        }
     
        return results;
    }
  2. Nathan
    Nathan avatar
    1 posts
    Registered:
    24 Aug 2012
    24 Aug 2012
    Link to this post
    Hi,

    It appears that you need to add one or more of the below "using" statements (for C# developers) to reference the namespaces that will expose that method (via http://bit.ly/NNRPzr):

    using Telerik.Sitefinity.Pages.Model;
    using Telerik.Sitefinity.Modules.Pages;

2 posts, 0 answered