Sandy
03/07/2025, 4:23 PMcsharp
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockListItem>;
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;
@using Umbraco.Cms.Core.DependencyInjection;
@{
var content = (ContentModels.InsightsCarouselBase)Model.Content;
var settings = (ContentModels.InsightsCarouselBase)Model.Settings;
}
@if (content != null)
{
...
}
InsightCarouselLatest
csharp
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockListItem>;
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;
@{
var content = (ContentModels.InsightsCarouselLatest)Model.Content;
var settings = (ContentModels.InsightsCarouselLatest)Model.Settings;
}
@{
Html.RenderPartial("~/Views/Partials/blocklist/components/InsightsCarouselBase.cshtml", content);
}
InsightCarouselPicked
csharp
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockListItem>;
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;
@{
var content = (ContentModels.InsightsCarouselPicked)Model.Content;
//var settings = (ContentModels.InsightsCarouselPicked)Model.Settings;
content.Insights = content.PickedInsights.Cast<InsightsPage>().ToList();
}
@await Html.PartialAsync("~/Views/Partials/blocklist/components/InsightsCarouselBase.cshtml", content)
Sandy
03/07/2025, 4:26 PMSandy
03/07/2025, 4:27 PMbielu
03/07/2025, 9:20 PM@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockListItem<ContentModels.InsightsCarouselLatest,ContentModels.InsightsCarouselLatest>>;
@{
var content = Model.Content;
var settings = Model.Settings;
}
@{
Html.RenderPartial("~/Views/Partials/blocklist/components/InsightsCarouselBase.cshtml", content);
}
and I thinkn it is how it worked, but not sure~~
actually, Reading it again,
Html.RenderPartial("~/Views/Partials/blocklist/components/InsightsCarouselBase.cshtml", content); so you pass only InsightsCarouselLatest into InsightsCarouselBase, but you need whole BlockListItem so you would need to pass like this:
@{
Html.RenderPartial("~/Views/Partials/blocklist/components/InsightsCarouselBase.cshtml", Model
);
}