Render block grid item when used as composition on...
# help-with-umbraco
b
I have a Header block which has two properties: a tagline and heading. This can be used on its own, but it also used a composition on a few another blocks. The following works inside an existing block, but I wonder if there's another or better way to handle this?
Copy code
@if (content is IBlockHeader header)
{
    var blockHeader = new BlockHeader(header, _iPublishedValueFallback);

    var blockItem = new Umbraco.Cms.Core.Models.Blocks.BlockGridItem<BlockHeader>(Model.ContentUdi, blockHeader, null, null);

    @await Html.PartialAsync("BlockGrid/Components/" + BlockHeader.ModelTypeAlias, blockItem)
}