AI OnAI Off
Here is the stack trace for the exception. This only happens when it encounters a dynamic content control...
[NullReferenceException: Object reference not set to an instance of an object.]
EPiServer.DynamicContent.DynamicContentAdapter`1.GetControl(PageBase hostPage) +236
EPiServer.Core.Html.StringParsing.DynamicContentFragment.GetControl(PageBase hostPage) +66
EPiServer.Web.PropertyControls.PropertyLongStringControlBase.CreateDefaultControls() +455
EPiServer.Web.PropertyControls.PropertyDataControl.CreateChildControls() +173
System.Web.UI.Control.EnsureChildControls() +102
EPiServer.Web.PropertyControls.PropertyDataControl.SetupControl() +31
EPiServer.Web.PropertyControls.PropertyLongStringControl.SetupControl() +110
*.Web.Templates.Public.Pages.LandingPage.GetRenderedXhtmlText(PropertyXhtmlString content)
*.Web.Templates.Public.Pages.LandingPage.OnItemDatabound(Object sender, RepeaterItemEventArgs e)
System.Web.UI.WebControls.Repeater.OnItemDataBound(RepeaterItemEventArgs e) +115
I actually figured this out. Basically I was just decorating the UserControl with the DynamicContent attributes but this wasn't enough. I had to implement IDynamicContent for EPiServer to recognize GetControl method.
I am trying to get my dynamic content to render in a page that uses a PropertyDataCollection instead of an EPiServer property. Initially it was just rendering the Dynamic Content control itself instead of the content. I found the following page that explains how to get around this issue but I am encountering a runtime exception with this method.
http://tedgustaf.com/sv/blogg/2009/9/parse-an-episerver-xhtml-property-with-dynamic-content/
I get a null reference error on the call to SetupControl() within GetRenderedXHTMLText below when rendering Dynamic Content. Here is the relevant code...
1- As we iterate over the properties, output the content...
2- Try to render the content. This method works fine for any property that doesn't have a dynamic content control in it.
My dynamic content is a user control decorated with the DynamicContentPlugin attribute.
3- Here is my custom editor user control
4- Here are the relevant parts of the dynamic content user control itself
Well, sorry for the long post, but would like to get this working and have no idea what is missing from my dynamic content control that makes SetupControl fail...
Any ideas?