Dynamic Content wont render


Hi. I´m trying to get my first Dynamic Content to work. The problem is it wont render, the yellow box is still there after saving and publishing.

When I debug it seems like the GetControl method never gets called and the State property get/set-methods gets called several times.

Can anyone point me in the right direction?

DynamicHeadline.cs (The dynamic content class)

DynamicHeadlineSettings.ascx.cs (The settings set in edit mode)


Thank you!

#26289 Dec 01, 2008 14:51
  • Anders Hattestad
    Member since: 1996


    what do

    public string Text { get; set; }

    public string Template { get; set; }


    #26292 Edited, Dec 01, 2008 17:10
  • Anders Hattestad
    Member since: 1996

    Hi again

    I guess that you dont update the value of the dynamic content class based on what Text and Template is. Therfore when you save you save the empy Value and not the combined value of Text and Template.

    #26293 Dec 01, 2008 17:15
  • Anders Hattestad
    Member since: 1996
    #26300 Dec 01, 2008 21:47
  • Per Hemmingson
    Member since: 2006
  • Espen Limi
    Member since: 2007

    Did you figure out what the problem was?

    I'm stuck in the same situation, the dynamicproperty renders with control in my develompment enviroment, but as soon as i move it to test it stops.. It runs the constructor and state over and over again, and once in a while it checks the rendering method.. but it never runs the GetControl method. 


    I figured out what the problem was (in my case). 

    I had a custom rendering of propertylongstring's.. and that screwed up the rendering of the dynamic content.. Once this was disabled it all worked like a charm. 

    I used steves howto (http://labs.episerver.com/en/Blogs/Steve-Celius/Dates/112266/2/Taking-Control-of-Property-Rendering/ ) and registered the new propertydatacontroladapter in adaptermappings.browser (instead of global.asax.cs). 

    Is there any nifty way of checking wether or not a  property contains dynamic content?

    #28050 Edited, Feb 18, 2009 14:04
  • Anders Hattestad
    Member since: 1996

    yes :),

    if its extends PropertyXhtmlString and one of the items in StringFragments is DynamicContentFragment then it contains a dynamic content control

    check out http://labs.episerver.com/en/Blogs/Anders-Hattestad/Dates/2008/11/Please-devs-you-are-making-a-framework-dont-use-privateinternal/


    #28076 Feb 18, 2009 23:25
  • Espen Limi
    Member since: 2007
    Great, thanks:)
    #28077 Feb 19, 2009 8:17
  • Espen Limi
    Member since: 2007

    I still want to override the rendering of propertystrings, and this is how i solved it.

    Instead of creating a new panel that stores all the controls for the property i just add my controls directly into the parents controlcollection, and thus getting rid of the initial div for each property. 

    Here's the code from my implementation of the propertycontroladapter.

    public override void CreateDefaultControls()

    ControlCollection target = base.Control.Controls;
    PropertyXhtmlString propertyData = base.PropertyData as PropertyXhtmlString;
    if (propertyData != null)
    foreach (IStringFragment fragment in propertyData.StringFragments)
    Literal child = new Literal();
    child.Text = this.ToWebString();




    #28082 Feb 19, 2009 10:27
  • Lise Engmo Eggum
    Member since: 2007


    I also have this problem. My dynamic content won't render, it only displays that yellow box. The constructor and state is run several times, but GetControl is never called. RendersWithControl returns true.

    I tested the DynamicPageProperty that is included in the basic episerver site, and that one also just renders that yellow box. So I get the feeling my site is missing something basic to enable rendering of dynamic content....

    I do not override rendering of propertystrings so the solution Espen Limi gave doesn't do anything for me.

    Anyone know what might be wrong?

    #29532 May 04, 2009 8:37
  • Anders Hattestad
    Member since: 1996

    Could it be that you display the property like <%=CurrentPage.Property["MainBody"]%>

     sorry, had to ask :)

    #29534 May 04, 2009 10:06
  • Lise Engmo Eggum
    Member since: 2007

    <EPiServer:Property PropertyName="MainContent" runat="server" />


    #29536 May 04, 2009 10:32
  • Anders Hattestad
    Member since: 1996
    and the MainContent is of propertyxhtmlstring?
    #29540 May 04, 2009 12:38
  • Lise Engmo Eggum
    Member since: 2007
    Ah no, it was a regular longstring property :) While the dynamic content is available there too, I didn't even think about it. Thanks!
    #29550 May 04, 2009 14:52
  • Per Gunsarfs
    Member since: 2005


    Nice catch, this is an oversight on our side. The tool shouldn't be avaliable on a property that can't use the result :)

    I'll register it as an issue and our triage will take a look at it. Although this could be something that's very hard to fix, due to the way the editor works.


    Per Gunsarfs
    EPiServer CMS development team

    #29558 May 05, 2009 10:26

    Thanks guys, your suggestions helped me solved my problem.



    #35714 Edited, Dec 22, 2009 2:20