Eval Method Comparable MVC
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();