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?

2 posts, 1 answered
  1. H
    H avatar
    0 posts
    Registered:
    14 Mar 2017
    08 May
    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 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