Images are only filled after filtering - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Images are only filled after filtering

  • Images are only filled after filtering
  • Hey there,

    I am developing a website with custom content types. I created the content types with the module builder (latest Sitefinity).

    All custom content types contain images. I can see the images in the backend, after creating the items. When I am querying the items with
    var dynamicModuleManager = DynamicModuleManager.GetManager(PROVIDER_NAME);
    var editionType = TypeResolutionService.ResolveType(TYPE_NAME);
    IQueryable<DynamicContent> allEditions = dynamicModuleManager.GetDataItems(editionType);

    And getting the images with:

    the return value is an empty list. I also tried to cast them to ContentLink[] as mentioned here and here but this throws an exception. What works is a cast to ICollection<IDataItem>

    In one of the content types there is an field of type Address. After filtering these items with:

    the Images field is not empty anymore.

    In other content types I do not have this option. Can someone help me?

    Best regards,

  • Try this

    dataItem.GetRelatedItems<Image>("Images"); more stupid dealing with get a list of pure image objects

  • I tried it, but the enumeration is empty. Just like I said.

  • Hey there,

    when I am getting a single item with
    dynamicModuleManager.GetDataItem(editionType, id);

    the Images are present. Then I can use 

    as suggested by Steve.