Rendering Block list item inside a Block Grid
a
I'm trying to create a repeatable set of properties (previously I used Nested content ) to be used as a Block grid element. Is it possible to use a blocklist element inside the block grid? Or is there any other / simpler property editor to achieve what I'm trying to do? I'm using Umbraco V12
n
Its perfectly okay to combine Block Grid and Block List. As far as I'm aware there is no limitations to how or how many times you combine these. Let me know how it goes 🙂
a
Managed to get it working now. Thank you 😄
r
@Aksel Sorry to necro this thread, but I am trying to render a block list within a block grid. I'm new to Umbraco and have probably just messed it up. I have the Back Office set up and working (using a content pick to pick from a library in Content and placing that item in Block List). How is it you are rendering in your view from a Block Grid. I have: "`@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage @Model.Content.Value("contentBlockList")`" where
contentBlockList
is my element type property in the data type.
a
Hey there 🙂 I have done it like this: @using Umbraco.Cms.Core.Models.Blocks; @inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage @{ var accordionItems = Model.Content.Value<IEnumerable>("accordionItems"); } @foreach (var accordionItem in accordionItems) { var content = accordionItem.Content; }
r
@Aksel Thank you for the quick response. I'm not able to get it to work but I'll keep digging.