Get Image from the custom content type's field

Posted by Community Admin on 04-Aug-2018 01:42

Get Image from the custom content type's field

All Replies

Posted by Community Admin on 30-Nov-2015 00:00

Hi,

Hope I can get some help here.

I created a custom content type through module builder, called "Our People".

Simply, "Our People" only has two fields, Name(text field), and a photo(image select field). Photo field is created by the module builder, so the relation is created, I suppose.

Now I need to display all the "Our People" in a MVC widget. How can I get the image URLs in the controller and put them into the viewmodel?

 

The following codes are not working at all

 var myCollection = dynamicModuleManager.GetDataItems(ourPeopleType).Where(i => i.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && i.Visible == true).Select(i => new OurPeopleModel                
                                               
  Name = i.GetValue<string>("Name"),                                        Photo=i.GetValue<Image>("Photo")
);

This thread is closed