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 just can't think how to do this tonight :(
With the following structure, when in the template for Event Date I want to get the home node using razor so I can then build the navigation.
Home-- AboutEvent Container--- Event--- Event
I was using this
DynamicNode homeNode = @Model.AncestorOrSelf();
but it doesn't work from an event page. I thought the following might work however I get a "Cannot perform runtime binding on a null reference"
DynamicNode homeNode = (DynamicNode)@Model.AncestorOrSelf(-1).Descendants("Home").First();
I'm still trying to learn razor so don't really understand what's going on. How do I get the home node.
When i first started with razor, this cheatsheet really helped
I worked it out.
@Model.NodeById(-1).Home.First()
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Getting home node from sibling
I just can't think how to do this tonight :(
With the following structure, when in the template for Event Date I want to get the home node using razor so I can then build the navigation.
Home
-- About
Event Container
--- Event
--- Event
I was using this
but it doesn't work from an event page. I thought the following might work however I get a "Cannot perform runtime binding on a null reference"
I'm still trying to learn razor so don't really understand what's going on. How do I get the home node.
When i first started with razor, this cheatsheet really helped
I worked it out.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.