Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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.
The Multinode Treepicker always returns an IEnumerable in my experience.
See how you get on with that.
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.
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?
I am running 7.13.
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
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted