6

I am using the Sitecore 9 default implementation of Dynamic Placeholders, and everything works fairly well. However, the one issue I've had is that the Dynamic Placeholders all overlap each other in the Experience Editor, making it very difficult to actually add content to these placeholders. Thus far I have been unable to find a cause for this.

My code is as follows:


On the main page:

@Html.Sitecore().DynamicPlaceholder("modules", 5)


On the module added to the first dynamic placeholder:

@Html.Sitecore().DynamicPlaceholder(new DynamicPlaceholderDefinition("cards")
 {
     Count = Model.CardCountPerRow,
     OutputModifier = (input, context) => new HtmlString("<div class=\"" + Model.ColumnClass + "\">" + input + "</div>")
 }

Has anyone else encountered this and is there a way to fix it?

Update: It appears that when I add different types of modules, they appear correctly. It is only when I try to add multiple instances of the same module type that they overlap each other.

3
  • Did you put a <div> arround your placeholder? <div>@Html.Sitecore().DynamicPlaceholder("modules", 5)</div> Jun 15, 2018 at 9:08
  • @BartVerdonck I have tried that, but it doesn't seem to make a difference. I do have some more information relevant to this issue which I will add to the original post.
    – Xalor90
    Jun 19, 2018 at 20:27
  • It was just a wild suggestion. I know that you can have like duplicated placeholder input area's when the placeholder is not wrapped in a div. Jun 20, 2018 at 10:00

1 Answer 1

3

So, after wrestling with this for awhile, I finally figured out what the problem was. It seems I had forgotten to assign a placeholder setting to the dynamic placeholder, which then caused rendering issues since the Experience Editor couldn't tell the difference between the dynamic placeholders. The reason it displayed correctly when the placeholders were empty or when the placeholders had different modules plugged in was because the EE could then see that the placeholders were indeed different and not the same.

tl;dr - Make sure you assign a placeholder setting to your dynamic placeholders!

Edit: I also found that the EE was interfering with my CSS and JS, so I was able to make some changes that corrected some of my rendering issues.

1
  • Updated the answer with some additional notes on things I've found recently.
    – Xalor90
    Jul 10, 2018 at 16:21

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.