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
Hello,
I'm having difficulty with the new umbraco.NodeFactory.Node class.
Previously (using umbraco.presentation.nodeFactory), I was able to get the parent node like this:
Node n = new Node(1234);Node p = n.Parent;
Doing that in ver 4.6.1 (using umbraco.NodeFactory.Node) gives me this error:
"Cannot implicitly convert type 'umbraco.interfaces.INode' to 'umbraco.NodeFactory.Node'."
I could go back to using umbraco.presentation.nodeFactory.Node - but I try to avoid using depricated classes.
Any help is appreciated.
Thanks,
David Hill
Hi,
Not sure why it returns INode instead of Node, but as a workaround I've used
Node n = new Node(1234);Node p = new Node(n.Parent.Id);
-Tom
Hi Tom,
That sould work. Thanks for the help.
David
I use an extension method:
public static Node ParentNode(this Node node) { return new Node(node.Parent.Id); }
but getting a simple parent node shouldn't be this difficult.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Get Parent Node using C# (4.6.1)
Hello,
I'm having difficulty with the new umbraco.NodeFactory.Node class.
Previously (using umbraco.presentation.nodeFactory), I was able to get the parent node like this:
Doing that in ver 4.6.1 (using umbraco.NodeFactory.Node) gives me this error:
"Cannot implicitly convert type 'umbraco.interfaces.INode' to 'umbraco.NodeFactory.Node'."
I could go back to using umbraco.presentation.nodeFactory.Node - but I try to avoid using depricated classes.
Any help is appreciated.
Thanks,
David Hill
Hi,
Not sure why it returns INode instead of Node, but as a workaround I've used
-Tom
Hi Tom,
That sould work. Thanks for the help.
David
I use an extension method:
but getting a simple parent node shouldn't be this difficult.
is working on a reply...