Looks like your are sending a model of type BlockListItem into a view requiring an IPublishedContent type model.
In your example, you could send Model.Content, which is IPublishedElement, but you would need to update your EventsGrid view to take IPublishedElement instead of IPublishedContent. They are similar, so if you are not relying on stuff on the model, like Url, and tree things, it should be an easy switch.
Can a Blocklist Component view Load a PartialView?
Can a Blocklist Component view Load a PartialView? If so, what does that look like?
I've got this on my component view...
...and I'm getting this error...
Looks like your are sending a model of type BlockListItem into a view requiring an IPublishedContent type model.
In your example, you could send Model.Content, which is IPublishedElement, but you would need to update your EventsGrid view to take IPublishedElement instead of IPublishedContent. They are similar, so if you are not relying on stuff on the model, like Url, and tree things, it should be an easy switch.
@SorenKottal My partial does need the tree.
Can you show your partial? Do you need the tree based on the passed in model (you can't do that)
Thanks for your response @SorenKottal Here's the relevant server-side code on my partial:
I tried inheriting IPublishedElement but, then I couldn't do Umbraco.ContentSingleAtXPath.
Try
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<IPublishedElement>
@Soren Kottal many thanks!
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<IPublishedElement>
on my Partial Viewand
@await Html.PartialAsync("/Views/Partials/EventsGrid.cshtml", Model.Content, new ViewDataDictionary(ViewData) { { "skipX", 2 }, { "takeX", 3 }, { "exclude", "" } })
on my block list component view.That combo did the trick.
Thank you!
is working on a reply...