More in this section

Forums / General Discussions / Find page by title and grouping page's title

Find page by title and grouping page's title

3 posts, 0 answered
  1. Eric
    Eric avatar
    147 posts
    Registered:
    12 Nov 2007
    10 May 2011
    Link to this post
    I have the following code, which finds a page where the page title is "ABC" and the parent's title is "XYZ". This works well, but not if the parent is a grouping page. I can't find any properties indicating the title of a grouping page. I could probably do it some way by figuring out the URL.

    var page = App.WorkWith().Pages().LocatedIn(PageLocation.Frontend).Where(p => p.Title == "ABC" && p.Parent != null && p.Parent.Title == "XYZ" && p.ApprovalWorkflowState == "Published").Get().FirstOrDefault();

    Thanks
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    10 May 2011
    Link to this post
    Hello Eric,

    Try using UrlName property.

    Kind regards,
    Ivan Dimitrov
    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
  3. Eric
    Eric avatar
    147 posts
    Registered:
    12 Nov 2007
    10 May 2011
    Link to this post
    I guess it didn't have anything to do with the title. It was the ApprovalWorkflowState value, which was null for the grouping page. I changed it to the following and it seems to work...

    var page = App.WorkWith().Pages().LocatedIn(PageLocation.Frontend).Where(p => p.Title == "ABC" && p.Parent != null && p.Parent.Title == "XYZ" && (p.NodeType == NodeType.Group || "Published".Equals(p.ApprovalWorkflowState))).Get().FirstOrDefault();

3 posts, 0 answered