More in this section
Forums / Developing with Sitefinity / How to get image data from a dynamic module?

How to get image data from a dynamic module?

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 1 answered
  1. H
    H avatar
    0 posts
    Registered:
    14 Mar 2017
    08 May 2017
    Link to this post

    Hi all,

    I am currently struggling with getting image data from my dynamic module. I have tried searching the net but still can't seem to get it working.

    I have an IQueryable type which holds a collection of dynamic items. I am trying to do the following:

                   IQueryable<DynamicContent> rawBusinessBlocks = (Query to Sitefinity);

                    return rawBusinessBlocks .Select(b => new BusinessBlockType()
                    {
                        Title = b.GetValue<string>("Title"),
                        Body = b.GetValue<string>("Body"),
                        ExternalLink = b.GetValue<string>("ExternalLink"),
                        Image = b.GetRelatedItems<Image>("Image")
                    });

    When I try the above it returns an empty image collection. But when using a single item e.g. rawBusinessBlocks.FirstOrDefault().GetRelatedItems<Image>("Image") it does return an Image object. 

    Not sure why I can't query image data on an IQueryable collection instead of a single item, any ideas?

    Thank you all!

     

  2. H
    H avatar
    0 posts
    Registered:
    14 Mar 2017
    09 May 2017 in reply to H
    Link to this post
    See: http://stackoverflow.com/questions/43852850/how-to-retrieve-image-data-from-a-dynamic-module-collection-in-sitefinity-10
    Answered
2 posts, 1 answered