Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kiran 17 posts 109 karma points
    Jan 29, 2021 @ 14:33
    Kiran
    0

    How to Create NestedContent Item In SurfaceController

    Hello Everyone

    I am new to Umbraco. The document type has a named "Parent" which is a Nested Content data type that contains a list of "Child" document type without template. I am trying to add child items dynamically (in a Surface Controller) to parent. Can you please suggest me.

  • Huw Reddick 1685 posts 5918 karma points MVP c-trib
    Jan 29, 2021 @ 16:05
    Huw Reddick
    0

    Not sure if this helps, but in our site we synchronise products from another sytsem, so this is what we do to add the products(child items) to the shop (parent)

     var newproduct= contentService.Create("this product", parentid, "product");
    
        you can then set properties for newproduct using
    
        newproduct.SetValue("attributename",value);
    
        and the finally do
    
        contentService.SaveAndPublish(product);
    
  • Kiran 17 posts 109 karma points
    Feb 02, 2021 @ 11:01
    Kiran
    0

    Hi Reddick, Thank you for your response. It's working when adding child to parent but actually I am trying to add value to nested content property programmatically in document type page. I am having a bit of trouble getting it working fully.

Please Sign in or register to post replies

Write your reply to:

Draft