Not able to show image on View (MVC) created in Module Builder - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

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

  • Not able to show image on View (MVC) created in Module Builder
  • 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

  • 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:

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

    I hope this is helpful!
  • 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. 


  • Hi,

    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
  • Just to clarify... 

    MVC/Views/<Custom Module>/List.My Content Type.cshtml 

    Didn't work for me. 


    Did work. 
    Note: This is for a custom module put together in the CMS. And, ContentTypeDeveloperName can be found in the Custom Module when you click on the Content Type in the field 'Developer name of this content type'