Try Now
More in this section

Forums / Thunder / Not able to show image on View (MVC) created in Module Builder

Not able to show image on View (MVC) created in Module Builder

4 posts, 0 answered
  1. Mateen
    Mateen avatar
    10 posts
    01 Aug 2012
    26 Nov 2012
    Link to this post
    Hi Team,

    I am using the Module Builder to create one custom module. As we create module builder it generates ready-made code and returns collection which is fine, but in my scenario I am using MVC template.
    Now the issue is I am able to get the collection through DynamicModuleManager, in that collection I have one ThumbnailImage which I have to show on View.
    I am not able to get that image on View.

    Please find the attached screen shots to understand the scenario.
    Image1 : Collection return
    Image2 : Rendering on View
    Image3 : Error message getting.

    Please help..
    Thankx in advance

    Synechron Teachnologies

  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    18 Jul 2012
    29 Nov 2012
    Link to this post
    Hi Mateen,

    Media fields like image, docs, video, don't return actual content items or urls. Instead they return an array of type ContentLink, which point to the individual content items in the library. If you assigned it a single item, the array will have a single item in it (but it will still be an array).

    However you can easily retrieve this with a helper method that extracts the Guid from the content link and retrieves it from the library.

    There is an example of exactly this in this blog post: http://www.sitefinity.com/blogs/joshmorales/posts/josh-morales-blog/2012/01/19/retrieving_data_from_dynamic_modules_using_the_module_builder_api

    The GetImageUrl() method shows you how you can pass in a content item and get out an image url.

    I hope this is helpful!
  3. Jacques
    Jacques avatar
    427 posts
    28 Jun 2007
    13 Apr in reply to Mateen
    Link to this post

    Hi Mateen, 

    This is a very old post but I'm hoping you can help. We've just built a module with the Module Builder and we're using the MVC version of it (it generated both MVC and webform version), but now I'm unable to see how to map a custom View to this new module so that we can customize what is rendered. 


  4. Dimitri Cools
    Dimitri Cools avatar
    80 posts
    26 Oct 2016
    15 Apr
    Link to this post

    You can create your own layouts for your Dynamic Content and put them in 
    MVC/Views/<Custom Module>/List.My Content Type.cshtml
    MVC/Views/Custom Module/Detail.My Content Type.cshtml

    When you create the Dynamic content type Sitefinity will auto-generate a widget with templates for it. 
    You can go to Design -> Widget templates to inspect and eventually re-use the code within your custom templates.

    You can also refer to the below article for more details on this and the convention you need to follow:


    Dimitri Cools
    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
4 posts, 0 answered