Dynamic Content wont render

Vote:
 

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
Vote:
 

hi

what do

public string Text { get; set; }

public string Template { get; set; }

do?

#26292
Edited, Dec 01, 2008 17:10
Vote:
 

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
Vote:
 
#26300
Dec 01, 2008 21:47
Vote:
 
#26301
Dec 01, 2008 22:23
Vote:
 

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
Vote:
 

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
Vote:
 
Great, thanks:)
#28077
Feb 19, 2009 8:17
Vote:
 

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
Vote:
 

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
Vote:
 

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

 sorry, had to ask :)

#29534
May 04, 2009 10:06
Vote:
 

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

:)

#29536
May 04, 2009 10:32
Vote:
 
and the MainContent is of propertyxhtmlstring?
#29540
May 04, 2009 12:38
Vote:
 
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
Vote:
 

Hi

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.

Regards

Per Gunsarfs
EPiServer CMS development team

#29558
May 05, 2009 10:26
Vote:
 

Thanks guys, your suggestions helped me solved my problem.

Cheers

 

#35714
Edited, Dec 22, 2009 2:20
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.