Eval Method Comparable MVC

Posted by Community Admin on 04-Aug-2018 19:37

Eval Method Comparable MVC

All Replies

Posted by Community Admin on 09-Jun-2016 00:00

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.

Posted by Community Admin on 10-Jun-2016 00:00

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

 

 

 

This thread is closed