Dynamic Content wont render | Episerver Developer Community

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)
http://paste2.org/p/109209

DynamicHeadlineSettings.ascx.cs (The settings set in edit mode)
http://paste2.org/p/109210

DynamicHeadlineControl.ascx.cs
http://paste2.org/p/109212

Thank you!

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

    hi

    what do

    public string Text { get; set; }

    public string Template { get; set; }

    do?

    #26292 Edited, Dec 01, 2008 17:10
  • 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
  • Member since: 1996
     
    #26300 Dec 01, 2008 21:47
  • Member since: 2006
     
  • 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. 

     Update: 

    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
  • 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
  • Member since: 2007
     
    Great, thanks:)
    #28077 Feb 19, 2009 8:17
  • 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)
    {
    target.Add(fragment.GetControl((PageBase)this.Page));
    }
    }
    else
    {
    Literal child = new Literal();
    child.Text = this.ToWebString();
    target.Add(child);
    }

    }

     

     

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

    Hi!

    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
  • 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
First   1 2   Last