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
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:
var currentPage = Umbraco.AssignedContentItem;
<p>Current page name: @currentPage.Name</p>
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 :)
If anyone has the same issue, I solved it this way.
var umbracoHelper = new Umbraco.Web.UmbracoHelper(UmbracoContext.Current);
This will get you the current root-node.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted