is it on a page? eg does your homepage doctype have a LinkToContent property of Multi Node Tree Picker type?
or
do you have a NestedContent property, that allows for multiple Banners, and on each Banner there is a LinkToContent property?
I ask only as it's really common to use model.Value within a foreach loop, accidentally referring to the page model, rather than the model being looped, eg banner.Value<IEnumerable<IPublishedContent>>("linkToContent")
Sure you've checked the alias of the property is linkToContent it is case sensitive, been caught out by LinkToContent or linktoContent in this kind of frustrating scenario!
Should the underlying property editor for linkToContent be a MultiUrlPicker?
also if you have multiple things picked here - won't the code result in multiple links called 'learn more' (but that's a future thing... getting it to work is first priority!)
The linkToContent property is part of the home page node, and is not within a foreach loop where the var might be item
I have checked the case and spelling of the property a few hundred times.
I can try to change the property editor to use multi URL picker, but I am having this issue with another property that does need more than just the link to content.
I have limited the Property to allow the customer to pick a maximum of 1 value to keep the user from selecting multiple.
Something else to note... when I just place the property in the template as if it were a standard text field, I get the following value.
SO I see that there is some sort of value stored. and it is listing the document type at the end of it. As soon as I plug it in to the condition and the -Ienumerable-IPublishedContent-- it acts like there is no value.
multinode tree picker - iEnumerable IpublishedContent returning null
Hello All,
I am having trouble with the Multimode Tree Picker. The value always returns null despite the value being defined in Backoffice.
Here is the code.
My result is the link is not rendering because of the condition if bannerLink !=null. If I remove the condition I get an error.
it just seems like IEnumerableI PublishedContent is not returning any value.
Thanks in advance.
Hi Sam
A couple of things to check.,,
Where is the LinkToContent property defined?
is it on a page? eg does your homepage doctype have a LinkToContent property of Multi Node Tree Picker type?
or
do you have a NestedContent property, that allows for multiple Banners, and on each Banner there is a LinkToContent property?
I ask only as it's really common to use model.Value within a foreach loop, accidentally referring to the page model, rather than the model being looped, eg
banner.Value<IEnumerable<IPublishedContent>>("linkToContent")
Sure you've checked the alias of the property is linkToContent it is case sensitive, been caught out by LinkToContent or linktoContent in this kind of frustrating scenario!
Should the underlying property editor for linkToContent be a MultiUrlPicker?
in which case:
would be the way...
also if you have multiple things picked here - won't the code result in multiple links called 'learn more' (but that's a future thing... getting it to work is first priority!)
regards
Marc
Hi Marc,
Sorry for the late response... I took a Vacation.
The linkToContent property is part of the home page node, and is not within a foreach loop where the var might be item
I have checked the case and spelling of the property a few hundred times.
I can try to change the property editor to use multi URL picker, but I am having this issue with another property that does need more than just the link to content.
I have limited the Property to allow the customer to pick a maximum of 1 value to keep the user from selecting multiple.
Something else to note... when I just place the property in the template as if it were a standard text field, I get the following value.
Umbraco.Web.PublishedModels.AboutPageWithHighlights
SO I see that there is some sort of value stored. and it is listing the document type at the end of it. As soon as I plug it in to the condition and the -Ienumerable-IPublishedContent-- it acts like there is no value.
Thanks for the help.
Hi Sam
hope you had a good holiday
quick thought, if you've restricted the picker to 1 item is it just an IPublishedContent item?
eg
regards
Marc
Thanks Marc. That did the trick, and it seems so obvious thinking about it. Here is what I ended up with.
Looks good, sorry I didn't think it first!
is working on a reply...