Copied to clipboard

Flag this post as spam?

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

  • Frans Lammers 34 posts 297 karma points c-trib
    Dec 08, 2016 @ 10:12
    Frans Lammers

    Saving nested content of members


    We have added nested content to our members to store data of variable length such as the names of their children. I have made a surface controller in which a member can edit his/her profile and which also shows the nested content. It is possible for me to edit and save the custom porperties of members, but I can't get the nested content to work. I can fetch them in my GET-method and display them in my view, but I do not know how to save them in my POST-method.

    Here is my simplified viewmodel:

        public class MemberEdit : RenderModel

    { public int id { get; set; }

        public string Firstname { get; set; }
        public List <MemberNestedContent> Children { get; set; }


    my GET

            public ActionResult Index()
            string memberId = Request.QueryString["id"];
            IMember member = Services.MemberService.GetById(int.Parse(memberId));
            IPublishedContent extendedMember = Umbraco.TypedMember(member.Id);
            Member memberData = new Member(extendedMember);
            MemberEdit memberEdit = new MemberEdit();
   = int.Parse(memberId);
            memberEdit.Firstname = memberData.Firstname;
            memberEdit.Children = new List<MemberNestedContent>();
            foreach (IPublishedContent item in memberData.EmployeeChildren)
                memberEdit.Children.Add(new MemberNestedContent(item));
            return View(memberEdit);

    and POST

            public ActionResult Edit(MemberEdit memberEdit)
            if (!ModelState.IsValid)
                return View("Index", memberEdit);
            IMember member = Services.MemberService.GetById(;
            member.SetValue("Firstname", memberEdit.Firstname);
            // Save nested content???
            return RedirectToCurrentUmbracoPage();
  • Sven Geusens 161 posts 869 karma points c-trib
    Dec 08, 2016 @ 14:49
  • Frans Lammers 34 posts 297 karma points c-trib
    Dec 12, 2016 @ 15:05
    Frans Lammers

    Thank you!

    Your link guided me to this one as well:

    I got it all working using this information.

  • Tom van Enckevort 100 posts 387 karma points
    Dec 16, 2016 @ 22:13
    Tom van Enckevort

    When I saw this topic appear last week it reminded me that I had a draft blog post in progress about exactly the same subject, saving Nested Content data for a member property.

    I finally got round to finishing that blog post:

    As you can see it uses a slightly different approach with a strongly-typed model that gets (de)serialised from/to JSON.

Please Sign in or register to post replies

Write your reply to: