Doctype Grid Editor: pulling values from the main page into a grid cell
I am using Doctype Grid Editor and I have my site set up so that every page uses a "page" doctype, and in the "page" template I render a grid (@Html.GetGridHTML(Model.Content,”myGrid”)). This doctype also includes a boolean property called "hasSidebar".
Using doctype grid editor, I have it so that every cell in "myGrid" is rendered with a different doctype, each with it's own partial view.
What I want to do is, in each partial view, find out the value of "hasSidebar" for the page it is being rendered on.
So basically I think I'm asking if it's possible to pass in values from a parent doctype into a partial view that is being rendered within its template.
Doctype Grid Editor: pulling values from the main page into a grid cell
I am using Doctype Grid Editor and I have my site set up so that every page uses a "page" doctype, and in the "page" template I render a grid (@Html.GetGridHTML(Model.Content,”myGrid”)). This doctype also includes a boolean property called "hasSidebar".
Using doctype grid editor, I have it so that every cell in "myGrid" is rendered with a different doctype, each with it's own partial view.
What I want to do is, in each partial view, find out the value of "hasSidebar" for the page it is being rendered on.
So basically I think I'm asking if it's possible to pass in values from a parent doctype into a partial view that is being rendered within its template.
Any help would be greatly appreciated! Thank you!
Providing your partial view has
@inherits UmbracoViewPage
at the top , you should be able to use the UmbracoHelper do something like:But depending on what your doing, there might be a cleaner way to do it.
Hmmm, when I use that code, @currentPage.Name returns the name of the grid editor...
Here's what it looks like in grid.editors.config.js:
It's returning the word "Banner"
Hi Nicole, I'm struggling with the same. Did you find a solution?
What I'd like to do is traverse up to the root-node. Like Model.Site(). To get some property values.
Any help is welcome :) Arjan
If anyone has the same issue, I solved it this way.
This will get you the current root-node.
Cheers, Arjan
is working on a reply...