Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Do Dat 1 post 71 karma points
    Apr 30, 2018 @ 11:15
    Do Dat
    0

    Display Image from IEnumerable <IPublishedContent> in a partial view

    In controller I return an Inumerable to a partial view  

    public ActionResult News (RenderModel model, string Name)
             {
                 Where (x => x.Name == Name) .Where (x => x. IsVisible ()) FirstOrDefault ();
                 IEnumerable <IPublishedContent> Children = News.Children () Where (x => x.IsVisible ()) OrderBy ("UpdateDate"). Take (5);
                 return PartialView ("~ / Views / Partials / SmallNewsHome.cshtml", Children);
             }
    

    In the partial view I called the model: @model IEnumerable <IPublishedContent> and without @inherits Umbraco.Web.Mvc.UmbracoTemplatePage but so I can not use Umbra.TypedMedia (firstchild.GetPropertyValue <string> ("hinhAnh")) So what should I do in this case?

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    May 01, 2018 @ 06:31
    Dave Woestenborghs
    0

    Hi,

    Can you post the full code of the controller ? I can't see what kind of controller you are using (eg. surface, rendermvc,..)

    I also think something went wrong with the formatting.

    Can you also post the code of your views ? The one calling the controller action and the one used to render the action.

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft