More in this section

Forums / Developing with Sitefinity / Custom Queries for pages

Custom Queries for pages

5 posts, 0 answered
  1. fregas baratis
    fregas baratis avatar
    185 posts
    Registered:
    14 Nov 2002
    12 Feb 2008
    Link to this post
    I need to do a custom query to get a series of page objects back from the Sitefinity API.  If i were doing this in SQL, I would need  something like this:

    SELECT *
    FROM Page
    WHERE ParentPageID IN (guid1, guid2, guid3)

    Is there a way to do this?  Do i have to install nolics to do this or is there something built into the api?

    Thanks,
    Craig
  2. fregas baratis
    fregas baratis avatar
    185 posts
    Registered:
    14 Nov 2002
    13 Feb 2008
    Link to this post
    Hello?  Echo...echo...echo............
  3. Grant Means
    Grant Means avatar
    10 posts
    Registered:
    30 Jun 2006
    13 Feb 2008
    Link to this post
    Craig,

    I was looking into doing something similar but unfortunately haven't coded anything yet. Looking through the API though....

    In the Telerik.CMS dll, Telerik.CMS namespace there is a CmsManager object. It has a series of GetPage methods that should work for you.

    I don't see a method that lets you supply a list of Guids but there is a method  (GetPage(System.Guid)) for pulling a single page object. I suppose you could do a loop, which probably isn't ideal.

    There's also a method that let's you supply a parent id and looks like it pulls all of the child pages.

    Hope that offers some help...
  4. fregas baratis
    fregas baratis avatar
    185 posts
    Registered:
    14 Nov 2002
    13 Feb 2008
    Link to this post
    Yeah I looked at those and a loop would not be my first option.  I thought there might be some querying mechanism built into Nolics or the api without installing the nolics IDE.

    Initially i was using the GetPages class to query for child pages of one particular page, but now the client has made a change where they want to show all child pages of 3 different parent pages.

    Does Telerik have any words of wisdom here?  :)
  5. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    13 Feb 2008
    Link to this post
    Hi fregas baratis,

    You can use Sitefinity API.

    Every page object has a property pages, containing a collection of its child pages, and ParentID that holds the ID of its parent.

    You are able to get pages either by their ID (GUID) or collection of pages by having their parent page. Taking the pages one by one, you will be able to build series, collections or lists depending on your needs. To take a single page, use :
     
    CmsManager manager = new CmsManager();
    ICmsPage your
    Page = (ICmsPage)manager.GetPage(pageId);

    For more information about pages, check the Developers Manual, section What Can You Do With Pages in the Pages section.

    Please let us know if you need further assistance.

    Sincerely yours,
    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
5 posts, 0 answered