Copied to clipboard

Flag this post as spam?

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


  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Sep 06, 2013 @ 14:53
    David Brendel
    0

    Adding nodes to MNTP in Controller

    Hi all,

    does anybody know how i could add node id's to a mntp in a SurfaceController.

    Currently having a case where a user is able to create a new node from frontend and can relate it to some other nodes. Thought about saving the id's in a MNTP.

    Are there any other methods?

    David

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Sep 06, 2013 @ 14:59
    Sebastiaan Janssen
    0

    Something like this?

    var cs = Services.ContentService;
    var content = cs.GetById(UmbracoContext.PageId.Value);
    content.SetValue("YourMNTPPropertyAlias", "1234,1235,1236");
    content.Save();
    

    Works only if you're storing MNTP values as CSV of course.
    And it could be content.SaveAndPublish() if you want.

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Sep 06, 2013 @ 15:02
    Sebastiaan Janssen
    0

    (oops, updated the above to also include the Save())

  • 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.

Please Sign in or register to post replies