After spending like 4hrs trying to find out why a dynamic property was not being loaded properly on a webpage, I finally stumbled upon a website with such an easy solution. Basically we had a custom dynamic property which was supposed to output some data but EPiServer was not rendering the control properly.
In the source code, I expected to find :
<a style=”” href=”/Video/Vimeo/60255727/” class=”trigger-video” data-trackingid=”<a href=”><span></span>
<img src=”/Global/PersonalCover-Screengrab.jpg” alt=”Personal cover” />
</a>
…but here’s what I saw instead:
<div data-classid=”b30218a7-77fc-43dd-a844-81935aa9b35e” data-dynamicclass=”Video Plugin” data-state=”VgBpAGQAZQBvAEkAZAA=&NgAwADIANQA1ADcAMgA3AA==|VAByAGEAYwBrAGkAbgBnAEkAZAA=&PABhACAAaAByAGUAZgA9ACIAIgAgAG8AbgBjAGwAaQBjAGsAPQAiAF8AZwBhAHEALgBwAHUAcwBoACgAWwAnAF8AdAByAGEAYwBrAEUAdgBlAG4AdAAnACwAIAAnAFYAaQBkAGUAbwAnACwAIAAnAFAAbABhAHkAJwAsACAAJwBQAGUAcgBzAG8AbgBhAGwAQwBvAHYAZQByACcAXQApADsAIgA+AFYAaQBkAGUAbwAgAGwAaQBuAGsAIABoAGUAcgBlADwALwBhAD4A|SQBtAGEAZwBlAFUAcgBsAA==&LwBHAGwAbwBiAGEAbAAvAFAAZQByAHMAbwBuAGEAbABDAG8AdgBlAHIALQBTAGMAcgBlAGUAbgBnAHIAYQBiAC4AagBwAGcA|SQBtAGEAZwBlAEEAbAB0AA==&UABlAHIAcwBvAG4AYQBsACAAYwBvAHYAZQByAA==|QQBsAGkAZwBuAFIAaQBnAGgAdAA=&” data-hash=”jpJE7dVU4KCYCarsF+2bNaNENaNdJwG1niTwbyZc7CY=” contentEditable=”false” class=”epi_dc”><div class=”epi_dc_h”><div class=”epi_dc_l”><div class=”epi_dc_title”>Video Plugin</div></div><div class=”epi_dc_t”><a href=”#” class=”epi_dc_editBtn”>.</a><a href=”#” class=”epi_dc_previewBtn”>.</a></div></div></div>
EPiServer was not rendering the control properly but was just outputting the string.
The fix is really easy. All I had to do was change the way the dynamic content is being output in code.
So instead of this:
<%= CurrentPage.MyDynamicContent %> // wrong
I used this:
<EPiServer:Property runat=”server” PropertyName=”MyDynamicContent” />
Note that this is the way to render dynamic content in EPiServer but there’s a way you can force the literal output as well to work.