More in this section
Forums / Developing with Sitefinity / Eval Method Comparable MVC

Eval Method Comparable MVC

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 1 answered
  1. Decker
    Decker avatar
    2 posts
    Registered:
    28 Jul 2015
    09 Jun 2016
    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 2016
    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