Try our conversational search powered by Generative AI!

Tag helper issue in CMS12


Hi Team,

I have below tag helper code used to avoid extra divs for blocks in CMS11. but after upgrade to new CMS12 solution below code not working. Can you please let us know what is missing here to work in CMS12 framework?

<div class="row">
       @Html.PropertyFor(m => m.MainBody, new { Tag = "_CustomContentArea" })

_CustomContentArea.cshtml this view exists under Views/Shared/DisplayTemplates

@using EPiServer.Core
@using EPiServer.Web.Mvc.Html
@model ContentArea

    if (Model != null && Model.FilteredItems != null)
        foreach (var item in Model.FilteredItems)
            Html.RenderContentData(item.GetContent(), true);

Dec 19, 2022 16:52

Can you simply use @Html.Partial("Views/Shared/DisplayTemplates/_CustomContentArea.cshtml", Model.MainBody) instead?

Dec 20, 2022 9:38

If you want to skip extra element, soon renewed package will be released :)

But did you check what template renderers you have registered on MainBody type? Using just Tag - might not work properly. You can check templates nicely if you install EPiServer.DeveloperTools package (there is separate section for those).

Jan 19, 2023 17:34
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.