Copied to clipboard

Flag this post as spam?

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

  • Dave 8 posts 80 karma points
    Mar 18, 2019 @ 12:53

    Nested, Nested Content - Possible Bug? Or am I doing something wrong?

    Hey guys, hopefully someone can point me in the right direction here, but im having trouble getting the value of a nested, nested content.

    To get the first level (simplified):

    var firstLevel = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("nestedPropName")

    Then to get the second level (Assuming this nested, nested dataType has content for simplicity):

    foreach(var item in firstLevel){
        var nestedNestedContent = item.GetPropertyValue<IEnumerable<IPublishedContent>>("nestedNestedPropName")
        // returns null

    That comes out null But then doing this on the same dataset (Which I know isnt empty) does the right thing and returns true

    foreach(var item in firstLevel){
         var hasNestedContent = item.HasValue("nestedNestedPropName")
         // true

    ...........Huh?! Very strange.

    Has anyone managed to successfully get a nested content item, from within a nested content item.

    Version : 7.13.2

    Cheers all.

  • Harry Spyrou 211 posts 603 karma points
    Mar 18, 2019 @ 15:18
    Harry Spyrou

    Can you show the content tab of that specific Nested Content please?

  • Nik 1525 posts 6757 karma points MVP 5x c-trib
    Mar 18, 2019 @ 15:35

    Hey Dave,

    That does seem odd. It seems very similar to code I've seen before when accessing nested nested content and that's worked for me.

    What happens if you do this:

    var innerNestedContent = item.GetPropertyValue("nestedNestedPropName");

    The aim of the code being to let the runtime tell your what type innerNestedContent is.



Please Sign in or register to post replies

Write your reply to: