Hello all,
I’m trying to extract some data from block list but having no luck, its probably my rendering code that is wrong.
Steps
-
I created a data type called Matt Slide and then added “Carousel Slide” as an available block
-
Carousel Slide is an Element type with all my propertys
-
Then created a new partial view under block list in the componsents called “carouselSlide”
Inside that I have the following
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage;
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;
@using Umbraco.Cms.Core.Models.Blocks;
@{
var variants = Model.Value<IEnumerable<BlockListItem>>("carouselSlide").Select(x => x.Content);
foreach (var variant in variants)
{
<h4>@variant.Value("slideTitle")</h4>
}
}
But I keep getting the following error
ModelBindingException: Cannot bind source type Umbraco.Cms.Core.Models.Blocks.BlockListItem`2[[Umbraco.Cms.Web.Common.PublishedModels.CarouselSlide, ModelsGeneratedAssembly, Version=0.0.0.1, Culture=neutral, PublicKeyToken=null],[Umbraco.Cms.Core.Models.PublishedContent.IPublishedElement, Umbraco.Core, Version=13.5.3.0, Culture=neutral, PublicKeyToken=null]] to model type Umbraco.Cms.Core.Models.PublishedContent.IPublishedContent.
Thanks