Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
In my partial view I need to traverse the content tree and retrieve a collection of nodes with a specific doct type alias.
Here's my partial view code...
@inherits Umbraco.Web.Mvc.UmbracoViewPage @{ Layout = null; string filter = ViewData["filter"].ToString(); var root = Model.Root().Children().FirstOrDefault(x => x.ContentType.Alias == filter); var pages = root.Children() .Where(x => x.IsVisible()); }
Here's where I'm calling the partial view from my view... `@Html.Partial("ItemGrid", new ViewDataDictionary{{ "filter", "itemDetails"}})
I get this error when it tries to render my partial...
Value cannot be null. Parameter name: content
When I step through it, the Model is NULL here...
var root = Model
This worked.
var currentNode = Umbraco.AssignedContentItem.Root(); var root = currentNode.Root();
Found the answer on this post: https://our.umbraco.com/forum/templates-partial-views-and-macros/94410-get-current-root-node-from-nested-content-partial-view
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
v8 Partial View
In my partial view I need to traverse the content tree and retrieve a collection of nodes with a specific doct type alias.
Here's my partial view code...
Here's where I'm calling the partial view from my view... `@Html.Partial("ItemGrid", new ViewDataDictionary{{ "filter", "itemDetails"}})
I get this error when it tries to render my partial...
When I step through it, the Model is NULL here...
This worked.
Found the answer on this post: https://our.umbraco.com/forum/templates-partial-views-and-macros/94410-get-current-root-node-from-nested-content-partial-view
is working on a reply...