More in this section

Forums / Developing with Sitefinity / Creating a paged list of pages

Creating a paged list of pages

3 posts, 0 answered
  1. Doug
    Doug avatar
    34 posts
    Registered:
    20 Apr 2010
    10 Jun 2010
    Link to this post
    Hello,
       I have this somewhat working, albeit a bit messy, using reflection to get the data I need from the IList that is returned from the CmsManager.GetPages() method.  All I need to do is get all of the pages of a given parent, display the title of the page (which is also a link to the page) and the date it was created. Unfortunately IPage has the date and ICmsPage has the title and href so getting all three elements is going to be messy involving a series of loops. Is there an easier way to get a bindable list of all child pages of a given parent or am I stuck with the reflection route?

    Thanks. 
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    10 Jun 2010
    Link to this post
    Hi Doug,

    Try using code similar to this one shown below

    var Manager = new CmsManager();
          ICmsPage parent = (ICmsPage)Manager.GetPage(new Guid("aaa07348-3a86-40d4-9073-08bf442da48c"));
     
          string parentPageURl = parent.StaticUrl;
          string parentPageName = parent.Name;
          string parentPageMenuName = parent.MenuName;
          string parentPageDateCreated = parent.DateCreated.ToString();
          string parentPageDateModified = parent.DateModified.ToString();
           
          if (parent.Pages.Count > 0)
          {
              foreach (ICmsPage child in parent.Pages)
              {
     
                 string pageURl = child.StaticUrl;
                 string pageName = child.Name;
                 string pageMenuName = child.MenuName;
                 string pageDateCreated = child.DateCreated.ToString();
                 string pageDateModified = child.DateModified.ToString();
              }
          }


    Greetings,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Doug
    Doug avatar
    34 posts
    Registered:
    20 Apr 2010
    11 Jun 2010
    Link to this post
    Worked like a charm Ivan.  Thanks.
Register for webinar
3 posts, 0 answered