BlockList inside BlockGrid, how?

V13.7.1 + BlockPreview package

Trying my best to use a blockgrid block to add a carousel. Each item in the carousel has it’s own link, text, layout controls as well as the image, so I thought I’d have each one as a blocklist item and have a blockgrid (HeroBannerBlock) with just the blocklist (HeroBannerItem) as it’s only content. So far, so good.

Now I’m totally confused as to exactly what I need to render this in the back office.

If I add a HeroBannerBlock, then I can see an “Add Hero Banner Item” in the slideout. If I click on that, it fails, no further slideout, nothing.

As for partials, I now just have a HeroBannerItem.cshtml which would be the full carousel code. However, it breaks. If I replace it all with the work “Hello” then as soon as I click into “Add Hero Banner Item” I see the work “Hello” rendered in the slideout.

I suppose my questions are:-

  1. If I get it right, will this be beyond the scope of the BlockPreview package to render it in the back office?
  2. How do I get it right? Do I need a partial for HeroBannerBlock as well as one for the HeroBannerBlockItem?
  3. If I need a partial for HeroBannerBlock, what should be in it? I’ve tried one with just @Html.GetBlockListHtml(Model.Content.HeroBannerItem) in it, thinking it would then render out the BlockList, but it breaks.

What should be the right approach, whether I have to build my own backoffice renderer or not?

Thanks.

Ok, I’ve worked out why I didn’t get a slide out, it was because I had “Inline editing mode” active. Once I switched that off, I got a sensible slide out. Now the content shows on the web site, but it doesn’t show in the back office at all.

All I can see is an empty content border if I mouse over the area.

If I click into it to edit whatever’s there, all I see is a single “Add Hero Banner Item”, nothing else. Even though there must be one item there because it’s showing on the web page.

Any advice appreciated.

Thanks.

Finally got everything working (apart from the JS in the back office). So the answer was to have a Block Grid HeroBannerBlock partial which within it lists out the Block List HeroBannerBlockItems and contains all the logic and html for display on the web site. There is also a HeroBannerBlockItems partial which is ONLY for display in the back office. That’s handy because there are formatting changes needed to fit everything in neatly.

2 Likes

I see you have this resolved but if it helps I have examples of Block List in Block Grid here:

and

and a carousel here:

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.