Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Amir Khan 1282 posts 2739 karma points
    Dec 15, 2021 @ 22:22
    Amir Khan

    Pass block type alias to partial

    I have a block editor called Rich Text Editor that lets you choose from a variety of rich text editor combinations, is it possible to read the alias of the block type that was chosen from within the partial?


    Main block container:

    var blocks = content.RichTextEditor;
        foreach (var block in blocks)
            var blockType = block.Content.ContentType.Alias;
            @Html.Partial("Partials/BlockList/Components/RichTextEditors/" + blockType, block)

    Then in my partial I'm currently having to do this, what I'm trying to do is pass "RichTextTwoColumnWideLeft" from the container so I don't have to define it in each partial.

    var block = Model.Content as ContentModels.RichTextTwoColumnWideLeft;
Please Sign in or register to post replies

Write your reply to: