Copied to clipboard

Flag this post as spam?

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


  • Emil Lindgren 28 posts 190 karma points
    Dec 19, 2020 @ 12:42
    Emil Lindgren
    0

    Nested Contents (Elements) Name

    Hello, so im trying to get the elements name from elements inside a Nested Content. For example Nested Content Name/ Aliad = Elements Elements has many elements. Img -> enter image description here and i want the Name of the element: ->

    [ { "key": "3e22fc8b-6b26-4773-860f-dcb4a8ffbd67", "name": "Article Text", "ncContentTypeAlias": "articleText_Element", "articlePicker": "umb://document/b8286876b8364bb78ee01c62ecad97a2" } ]

    Any tips for me?

    Kind Regards / Emil

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Dec 19, 2020 @ 15:20
    Huw Reddick
    0

    try this

    var myelements = Model.Value<IEnumerable<IPublishedElement>>("elements");
    foreach (var item in myelements)
    {
        string name = detail.Value<string>("name");
        <!-- other properties etc -->
    }
    
  • Emil Lindgren 28 posts 190 karma points
    Dec 19, 2020 @ 21:53
    Emil Lindgren
    0

    I've already tried that one, no luck for that. :/

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Dec 20, 2020 @ 04:26
    Huw Reddick
    0

    Are you getting any errors?

  • Emil Lindgren 28 posts 190 karma points
    Dec 20, 2020 @ 15:01
    Emil Lindgren
    0

    No, i get nothing. but this is just getting the property name from the Element string name = detail.Value

    So i dont know how there's nothing to grab the name of the Element If you understand.

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Dec 20, 2020 @ 16:18
    Huw Reddick
    0

    Could you provide an example of the code you are trying

Please Sign in or register to post replies

Write your reply to:

Draft