More in this section

Forums / Developing with Sitefinity / content items parent ID

content items parent ID

4 posts, 1 answered
  1. Rabindra
    Rabindra avatar
    106 posts
    Registered:
    17 May 2009
    11 Mar 2010
    Link to this post
    hi there,
    In generic content module, why are the content item's parent ID = "00000000-0000-0000-0000-000000000000"?

    I am using 3.7 SP2.

    thanks.
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    11 Mar 2010
    Link to this post
    Hi Rabindra,

    Thank you for contacting Telerik Support.

    The ParentID property provides that generic content items from generic content based modules can be associated with a parent. For example in Blogs and Libraries the ParentID points to the holding blog or library respectively. In modules such as GC, News, and Events where these kind of associations are not supported the ParentIID will be an empty Guid.

    Sincerely yours,
    Radoslav Georgiev
    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. Rabindra
    Rabindra avatar
    106 posts
    Registered:
    17 May 2009
    11 Mar 2010
    Link to this post
    Hi Radoslav,
    If ParentID is not supported for GC then how am I supposed to get the contents of all subcategories of a category.
    Please take a look at this post.
    http://www.sitefinity.com/support/forums/sitefinity-3-x/developing-with-sitefinity/get-all-items-from-subcategories.aspx

    I was going to use this line of code where ParentIDArray has IDs of all subcategories.

    Dim listofItems As IList = manager1.GetContent(0, 0, "Name ASC", parentIDArray)

    Please suggest?
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    11 Mar 2010
    Link to this post
    Hello Rabindra,

    Cotentitem.ParentID has nothing to do with Category.ParentID. This method call:
    Dim listofItems As IList = manager1.GetContent(0, 0, "Name ASC", parentIDArray) 
    will not work as you think it will. It will filter content items by their parent item not to the category they belong to. Here is sample code:
    Dim contentManager As New ContentManager()
    Dim parentCategory As ICategory = contentManager.GetCategory("Parent Category")
    For Each childCategory As ICategory In contentManager.GetCategoriesTree(parentCategory)
        Dim childCategoryItems As IList = contentManager.GetContent(New MetaSearchInfo(MetaValueTypes.ShortText, "Category", childCategory.CategoryName, SearchCondition.Equal))
    Next


    Sincerely yours,
    Radoslav Georgiev
    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.
    Answered
Register for webinar
4 posts, 1 answered