Copied to clipboard

Flag this post as spam?

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


  • Andreas Kristensen 71 posts 285 karma points c-trib
    Jan 11, 2019 @ 13:54
    Andreas Kristensen
    0

    Values converter for Multinode Treepicker in nested content does not work, but it does for Media Picker

    I am very frustrated, because I have not been able to get this to work for hours.

    I have two different Nested Content data types, one has a Media Picker and some more properties, the other one has a Multinode Treepicker and some more properties.

    When i try to get the value of the media picker, like item.GetPropertyValue<IPublishedContent>("imagePicker"), it works, i get the values as an IPublishedContent just fine.

    Now, when i try to get the value of the Multinode Treepicker in the other Nested Content data type, i only get null. I call it like the documentation says you should call it (basically, like the Media Picker). If I try to get the value, without casting it (item.GetPropertyValue("propAlias")), I get the value just fine, but the second I try to cast it to an IPublishedContent, I get NULL. It's the same for a Multinode Treepicker with multiple items: when I try to cast it, I get NULL.

    Help me, you are my only hope.

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Jan 11, 2019 @ 14:10
    Nik
    100

    Hi Andreas,

    The Multinode Treepicker always returns an IEnumerable in my experience.

    Try

    item.GetPropertyValue<IEnumerable<IPublishedContent>>("propAlias")
    

    See how you get on with that.

    Nik

  • Andreas Kristensen 71 posts 285 karma points c-trib
    Jan 11, 2019 @ 16:53
    Andreas Kristensen
    0

    Hi Nik.

    That is exactly the way I do it. But it does not work. It works on a Media Picker, and a regular Multinode Treepicker outside of a Nested Content data type.

    I can also get the value of the Multinode Treepicker by not casting to an IEnumerable, but as soon as I try to cast it, it returns NULL.

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Jan 11, 2019 @ 16:58
    Nik
    0

    Hi Andreas

    What version of Umbraco are you using?

    Also, if you get the value by not specifying it and look at it in a watch/local window when debugging, can you see what type it is?

    Thanks

    Nik

  • Andreas Kristensen 71 posts 285 karma points c-trib
    Jan 11, 2019 @ 18:03
    Andreas Kristensen
    0

    Hi Nik.

    I am running 7.13.

    BUT!

    I just went back to my machine, to run a debug and check the type. I tried to change the Multinode Treepicker that I would cast without an IEnumerable, to <IEnumerable<IPublishedContent>> and now it works.

    I am baffled... I had been debugging for hours, and I am 100% sure I tried that also... I should have just gone home for the day :P

Please Sign in or register to post replies

Write your reply to:

Draft