Content load failes for dynamic modules with hierarchical structure - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Content load failes for dynamic modules with hierarchical structure

  • Content load failes for dynamic modules with hierarchical structure
  • I have a question about how to get childs for
    a dynamic module.

    The code I have works, but sometimes the content.SystemChildItems
    returns null (for same object). Why is it only loaded sometimes?If I call the
    page 5-6 times, one of them will return null. It does not make sense. Can't I
    trust that the dynamicModuleManager.GetDataItem will load the objects or what
    am I doing wrong?

    Here are some code
    stringproviderName = string.Empty;
    DynamicModuleManager dynamicModuleManager =
    Type sliderType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Slider.Slider");
    DynamicContent item = dynamicModuleManager.GetDataItem(sliderType,
    boolchildren = dynamicModuleManager.HasChildItems(item);
        foreach(DynamicContent content initem.SystemChildItems)
            // here the content.SystemChildItems is empty sometimes, but not always!
            foreach(DynamicContent layer incontent.SystemChildItems)

    I have tried to add this

    boolcontentChildren = dynamicModuleManager.HasChildItems(content);
        foreach(DynamicContent layer incontent.SystemChildItems)
            model.ErrorStep += 1;

    But then contentChilden is ALWAYS (??) false. I don't get it.

  • dynamicModuleManager.LoadChildItemsHierarchy(content);


    This did the trick I think

  • Hello Jan,

    Is this fix the issue you have?

    We highly appreciate shared solution with the community. Thank you for your involvement.

    Svetoslav Manchev
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
  • Hi Team,

    I have the same issue. But it is not working even after applying your solution.

    I'm getting an exception while loading the function "LoadChildItemsHierarchy"

    Exception is :  "Cannot build a query with DynamicContent type. Actual childType is required."

    I'm passing the parent content item as parameter to the function "LoadChildItemsHierarchy".

    My code is :


    I have no idea why it is happening. Anyone has any idea regarding why this exception is fired?