2

I have two row rendering

Row_1

<div>
    @Html.Sitecore().DynamicPlaceholder("section")
</div>

Row_2

<div>
    <div>
        @Html.Sitecore().DynamicPlaceholder("section")
    </div>
</div>

I make both of these compatible renderings of the other.

When I drop Row_1 on the page and put a 1 column rendering (Or any rendering) in the section placeholder, I get a presentation details like below.

Section

page-layout-{00000000-0000-0000-0000-000000000000}-0

One column

/page-layout-{00000000-0000-0000-0000-000000000000}-0/section-{23E68120-46D9-4066-B597-8A010998FEA6}-0

Now when I switch from Row_1 to Row_2 in compatible renderings, everything disappears and I only see the Section placeholder again.

If I add a 1 column to my now empty Section placeholder. I get a different sections ID. Notice the section is no longer {23E68120-46D9-4066-B597-8A010998FEA6}. It is now {1AEF33CD-6BB2-458D-9BC3-8F4D6C08B395}

Section

page-layout-{00000000-0000-0000-0000-000000000000}-0

One column

/page-layout-{00000000-0000-0000-0000-000000000000}-0/section-{1AEF33CD-6BB2-458D-9BC3-8F4D6C08B395}-0

I have tried some of the extra configuration for the placeholder, besides just the name. But it seems to fail the same way. This did work with Sitecore 8.2 and the Dynamic Placeholders nuget.

Thanks all

2 Answers 2

1

I had the same problem after switching to the new style dynamicplaceholders after upgrading to Sitecore 9.0.2. You will have to upgrade the dynamicplaceholders For the entire content tree to the new style. That will fix the issue. For all new content, your code will take care.

Mostly Following the blog

https://jeroen-de-groot.com/2018/01/17/fix-invalid-dynamic-placeholders-after-upgrading-to-sitecore-9/

with some customization worked! Customization were mostly to refactor and provide a tool in our tool set instead of an admin page.

0

I guess it is just how Sitecore creates the Dynamic placeholder differently and it guarantees a uniqueness to placeholder key across different renderings.

Quote from Sitecore Docs

Unlike a regular Sitecore placeholder that uses placeholder name as a placeholder key, a dynamic placeholder generates a unique key. The dynamic placeholder key looks like this:

{placeholder key}-{rendering unique suffix}-{unique suffix within rendering}

Where

  • rendering unique suffix - UID of a rendering that contains the placeholder. It guarantees a uniqueness to placeholder key across different renderings.
  • unique suffix within rendering - index number of a dynamically generated placeholder. First number equals to the Seed.

When u swap out Row_1 for Row_2, the Row_1's dynamic placeholder key goes away and components that were previously added to Row_1's dynamic placeholder will not be rendered. That is because "rendering unique suffix" used to build the dynamic placeholder key is unique to the rendering component.

To solve your problem, you can either

  • Avoid swapping out components with DynamicPlaceholders by creating another rendering that holds the DynamicPlaceholder, while your Row_1 and Row_2 uses static placeholders.
  • or change the way "rendering unique suffix" is generated via mvc.getDynamicPlaceholderKeys Sitecore pipeline

You can find more details in the Sitecore Docs for Dynamic Placeholders

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.