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
Hi,
I use the following code to create a node from the Controller: which create a node on the base of the Parent node [ParentGuid]:
using Umbraco.Web.Mvc; var contentService = Services.ContentService; var newNode = contentService.Create("node Name", [ParentGuid], "docTypeName"); .... .... contentService.Save(newNode);
Now I need to create a node on the root level, so need guidance on it. How to create a node at the root level?
Thanks
BJ
Hi BJ
Historically, if you set the value of the parent to -1
That means the 'root' of the tree you are creating the item in.
I say historically, as I haven't done it for a while, and I'm not sure things changed when udi's were introduced, but I reckon it's 'still the way'.
regards
Marc
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
How to Create node on Root In umbraco 8 From controller
Hi,
I use the following code to create a node from the Controller: which create a node on the base of the Parent node [ParentGuid]:
Now I need to create a node on the root level, so need guidance on it. How to create a node at the root level?
Thanks
BJ
Hi BJ
Historically, if you set the value of the parent to -1
That means the 'root' of the tree you are creating the item in.
I say historically, as I haven't done it for a while, and I'm not sure things changed when udi's were introduced, but I reckon it's 'still the way'.
regards
Marc
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.