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 followed this guide: https://codeshare.co.uk/blog/how-to-create-a-carousel-in-umbraco-using-nested-content-and-bootstrap/ to implement a slideshow made as a Nested Content in a Composition.
The following line fails:
IEnumerable<IPublishedContent> carousel = Umbraco.AssignedContentItem.GetPropertyValue<IEnumerable<IPublishedContent>>("slideshowDoc");
The alias is taken from my doc type:
The error I get:
'IPublishedContent' does not contain a definition for 'GetPropertyValue' and no accessible extension method 'GetPropertyValue' accepting a first argument of type 'IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
I have tried to do some research and attempted the advices given in: https://github.com/umco/umbraco-nested-content/blob/develop/docs/assets/pdf/Nested-Content--Developers-Guide-v1.0.pdf but with no success unfortunately.
Do you guys have any advice?
Hi, If you are using Umbraco 8 the syntax for fetching values is different it will be like
var carousel = item.Value<IEnumerable<IPublishedContent>>("slideshowDoc", fallback: Fallback.ToLanguage, defaultValue: null);
Above can be used for fetching media and node values, if its a nested content type element then the syntax will be
var carousel = item.Value<IEnumerable<IPublishedElement>>("slideshowDoc", fallback: Fallback.ToLanguage, defaultValue: null);
Hope that helps.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted