I am currently having an issue where I have several doc types which has a composition of Featured Image. I have used a multi node tree picker on another node which allows you to pick these Nodes that have the composition of Featured Image, so I am trying to convert these nodes during a foreach to "FeaturedImage", however, I get the error
Unable to cast object of type
'Umbraco.Extensions.Models.Generated.GeneralContent' to type
'Umbraco.Extensions.Models.Generated.FeaturedImages'.
When using the code below:-
@foreach (var CTA in Model.CtaPages.RandomOrder().Take(2).ToList().ConvertAll<FeaturedImage>(x => (FeaturedImage)x)) { //Content would appear hear }
Any help advise on if this can be done and how to do it would be greatly appreciated.
Converting doc type to Composition doc type
Hey,
I am currently having an issue where I have several doc types which has a composition of Featured Image. I have used a multi node tree picker on another node which allows you to pick these Nodes that have the composition of Featured Image, so I am trying to convert these nodes during a foreach to "FeaturedImage", however, I get the error
When using the code below:-
Any help advise on if this can be done and how to do it would be greatly appreciated.
Thanks
Maxi
is working on a reply...