hi
what do
public string Text { get; set; }
public string Template { get; set; }
do?
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.
Hi again
made a blog with a base class you can use
http://labs.episerver.com/en/Blogs/Anders-Hattestad/Dates/2008/12/Dynamic-Content-base-class/
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?
yes :),
if its extends PropertyXhtmlString and one of the items in StringFragments is DynamicContentFragment then it contains a dynamic content control
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);
}
}
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?
Could it be that you display the property like <%=CurrentPage.Property["MainBody"]%>
sorry, had to ask :)
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
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!