Blockgrid: get the grid-containing-node from a block-view
Hi there,
I have a block-view (if that's the correct name) that renders some content within the block-grid.
This view needs to display some data from a fixed Settings-node in the tree.
I have a extension-method on IPublishedContent to get to this Settings-node. But how do I get the node that contains the grid?
I tried using Umbraco.ContentAtXPath("//Settings") but this only works for the first node of type Settings in the tree.
So if I have multiple Home-nodes (each with a Settings-node underneath) I always get the Settings-node of the first Home-node.
Is it possible to get the current node I'm on, within the block-view? Or do I need to extend some of the grid-render-functions to pass the node along in the viewbag?
Cant you get the currentPage from the umbracoContext ? Then you can also get the settings from the current site using something like AncestorOrSelf().OfType
I do seem to have an UmbracoContext object, but I can't seem to figure out how to get the currentPage out of it.
UmbracoContext.Content returns an IPublishedContentCache?.
edit:
I've triedUmbracoContext.Content.GetAtRoot() but that just returns all root-nodes.
Blockgrid: get the grid-containing-node from a block-view
Hi there,
I have a block-view (if that's the correct name) that renders some content within the block-grid.
This view needs to display some data from a fixed Settings-node in the tree. I have a extension-method on
IPublishedContent
to get to this Settings-node. But how do I get the node that contains the grid?I tried using
Umbraco.ContentAtXPath("//Settings")
but this only works for the first node of typeSettings
in the tree.So if I have multiple Home-nodes (each with a Settings-node underneath) I always get the Settings-node of the first Home-node.
Is it possible to get the current node I'm on, within the block-view? Or do I need to extend some of the grid-render-functions to pass the node along in the viewbag?
Cant you get the currentPage from the umbracoContext ? Then you can also get the settings from the current site using something like AncestorOrSelf().OfType
I do seem to have an UmbracoContext object, but I can't seem to figure out how to get the currentPage out of it.
UmbracoContext.Content
returns anIPublishedContentCache?
.edit:
I've tried
UmbracoContext.Content.GetAtRoot()
but that just returns all root-nodes.I found it. I can get the parent page via:
Umbraco.AssignedContentItem
is working on a reply...