7

This is my first time with Dynamic Placeholders and I am unable to find any related tutorial.

I have installed the nuget package mentioned in the Fortis Site
https://www.nuget.org/packages/DynamicPlaceholders.Mvc/
and trying to render a component as

@Html.Sitecore().DynamicPlaceholder("section")

The component does not render on page and there are no errors.

If I just say:

@Html.Sitecore().Placeholder("section")

it works fine.

Apart from installing the package, should anything else be done.

Using Sitecore 8.2 with MVC

EDIT

The Fortis way seems complex. So, I have deleted the Fortis dll references and installed the package from the Marketplace. When browsing the page in preview mode, the error is

Sitecore.Mvc.Helpers.SitecoreHelper' does not contain a definition for 'DynamicPlaceholder
and no extension method 'DynamicPlaceholder' accepting a first argument of    
type 'Sitecore.Mvc.Helpers.SitecoreHelper' could be found (are you missing 
a using directive or an assembly reference?)'
4
  • 1
    Did you add the test component onto the page (in the xp editor) after your code had the dynamic placeholder?
    – Gatogordo
    Dec 20, 2016 at 14:06
  • 2
    Please ask a new question for the error - it is a different question to the original. Don't add new questions to your original post.
    – Richard Seal
    Dec 20, 2016 at 15:05
  • Since the edit is still there, sitecore.stackexchange.com/q/3491/288 is the question asked about that. Feb 9, 2018 at 21:11
  • It seems to be late, but for additional information about Dynamic Placeholder please see the below blog post. sitecore4you.com/2018/01/08/… Mar 8, 2018 at 8:32

1 Answer 1

8

It sounds like you have added the component to a placeholder key called section - with dynamic placeholders there will be an extra bit of data appended to that. Depending on the version of dynamic placeholders you have installed, that data changes.

If you have installed the Fortis Dynamic Placeholders - this appends the guid of the unique rendering Id to the place holder, so your placeholder key would be something like section-21ec20203aea1069a2dd08002b30309d - the best way to use this is to add components via the Experience Editor, that way the key is automatically worked out by Sitecore.

If you have the the version from the Sitecore Market Place - this uses numbers appended to the key. So the first section would just be called section, any subsequent placeholders using he same key would be section_2, section_3 etc...

Your component is being hidden because with the dynamic placeholder, the key of section on its own does not exist.

Update: How to add via the Content Editor For the Fortis implementation, to add renderings via the content editor requires you to go into the raw values of the __Renderings or __Final Renderings fields. In there will be the Xml that defines the layout. Find the rendering that contains your dynamic placeholder and then in the xml look for the uid of that rendering, that is the Guid that is appended.

<r id="{C4BD2E61-3025-4F88-9F7D-677086C576BA}" ph="header" uid="{8ED804CF-8F60-452C-A88B-4EEEB0145793}" />

Now when you add a rendering, append that guid to the placeholder key.

An alternative would be to add a rendering via the experience editor and then look at the placeholder key for that rendering, copy that and use it when adding more renderings.

4
  • I am using the nuget mentioned in the Fortis site. I'll try now adding from the Exp. Editor. But what about adding the controls from Content editor.
    – sukesh
    Dec 20, 2016 at 14:29
  • Edited to show how you could do it from the content editor.
    – Richard Seal
    Dec 20, 2016 at 14:35
  • Thank you. The Fortis method seems complex, so I resorted to the marketplace package and now it throws an error.
    – sukesh
    Dec 20, 2016 at 15:04
  • Please ask a new question for the error - it is a different question to the original.
    – Richard Seal
    Dec 20, 2016 at 15:05

Your Answer

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

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