Eval Method Comparable MVC - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Eval Method Comparable MVC

  • Eval Method Comparable MVC
  • ea66541e-37c1-6deb-a958-ff0000446526_capture.png

    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.

  • 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();