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

Posted by Community Admin on 05-Aug-2018 09:56

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

All Replies

Posted by Community Admin on 26-Nov-2012 00:00

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

Regards,
Mateen
Synechron Teachnologies

Posted by Community Admin on 29-Nov-2012 00:00
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: www.sitefinity.com/.../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!
Posted by Community Admin on 13-Apr-2016 00:00

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. 

?

Posted by Community Admin on 15-Apr-2016 00:00
Hi,

You can create your own layouts for your Dynamic Content and put them in 
MVC/Views/<Custom Module>/List.My Content Type.cshtml
and/or
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:

http://docs.sitefinity.com/feather-work-with-widget-templates

Regards,
Dimitri Cools
Telerik
 
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
 
Posted by Community Admin on 22-Nov-2016 00:00

Just to clarify... 

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

Didn't work for me. 

MVC/Views/<ContentTypeDeveloperName>/List.AnyName.cshtml

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'

This thread is closed