+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Eval Method Comparable MVC

Eval Method Comparable MVC

2 posts, 1 answered
  1. Decker
    Decker avatar
    2 posts
    Registered:
    28 Jul 2015
    09 Jun
    Link to this post

    I am working with MVC widget templates and have made a custom field in on my Page so I can create a "Hero/Mega Menu". However I am having issues get the image from the node. In webforms it is extremely easy with the Eval method....However running into a slight issue with MVC.  

     

    Ps I am working on the navigation widget template in bootstrap.

    Answered
  2. Victor Leontyev
    Victor Leontyev avatar
    65 posts
    Registered:
    01 Jul 2014
    10 Jun
    Link to this post

    Hi Decker

    You can receive image with ContentLinksManager

    var linksToRelatedItems = ContentLinksManager.GetManager().GetContentLinks()
                                .Where(cl => cl.ParentItemId == pageNode.Id &&
                                        cl.ParentItemType == pageNode.GetType().FullName &&
                                        cl.ComponentPropertyName == "Nav_Hero");
    if (linksToRelatedItems.Any())
    {
        var image = LibrariesManager.GetManager().GetImage(linksToRelatedItems.First().ChildItemId);
        ImageUrl = image.ResolveMediaUrl();
    }

     

     

     

2 posts, 1 answered