More in this section

Forums / Developing with Sitefinity / Get Image from the custom content type's field

Get Image from the custom content type's field

1 posts, 0 answered
  1. Yun
    Yun avatar
    1 posts
    15 Jul 2015
    30 Nov 2015
    Link to this post


    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")

1 posts, 0 answered