November Happy Hour will be moved to Thursday December 5th.

When in the control lifecycle does dynamic content execute?

Vote:
 

At what point in the Property control lifecycle does Dynamic Content do its thing?  If I override the Property control and do some string manipulation before calling Render, do I have to be concerned with anything?  So long as I don't alter the SPAN tag that represents the dynamic content, will it execute just fine?

#42350
Aug 19, 2010 15:19
Vote:
 

Hi

Maybe Paul or someone who knows it even better than I can answer more in depth, but the dynamic content rendering in triggered from CreateDefaultControls, which is executed from CreateChildControls.

I don't think there should be any problems as long as you leave the SPAN tag alone. We split the xhtml content into fragments when rendering, and the SPAN tag will be the Dynamic Content fragment. So don't mess with it, and I can't see any problem.

Regards

Per Gunsarfs
EPiServer Development Team

#42354
Aug 19, 2010 16:13
Vote:
 

I've extended the property control to have child controls, like this:

<Deane:SuperFantasticProperty PropertyName="PageName" runat="server">
   <Deane:SomeChildControl foo="bar"/>
</Deane:SuperFantasticProperty>
    

The child controls are parse via a "ParseChildren" attribute.  This apparently overrides the CreateChildControls method, and dynamic content no longer executes.


Any idea how I can have my cake and eat it too?

#42364
Aug 20, 2010 1:56
Vote:
 

Well, I'm guessing a bit here, but I think you need to make sure that the CreateCreateDefaultControls, CreateOnPageEditControls and CreateEditControls are called in the correct situations. It's those methods on the property controls that renders our properties in the "correct" way. We do that in the CreateChildControls of the PropertyDataControl.

If you want to handle the xhtml string yourself you need to use the PropertyXhtmlString.StringFragments property to get the rendering of things like dynamic content and permanent links right.

Hmm, not sure if I'm helping or confusing you...

Regards

Per Gunsarfs

#42377
Aug 20, 2010 11:13
Vote:
 

Per:

I've narrowed it does to the Render method.  The base method (on the Property) control executes dynamic content.  My override does not.

protected override void Render(HtmlTextWriter writer)
        {
            //This executes dynamic content
            base.Render(writer);

            //This does not execute dynamic content (assume "Text" is a string which contains the dynamic content SPAN)
            writer.Write(Text);
        }
    
#42402
Aug 22, 2010 3:37
Vote:
 

I got it.  I needed to call these two methods from within my Render override.

EnsurePropertyControlsCreated();
RenderChildren(writer);
Man, I can't tell you how valuable it is that your code is not obfuscated...
#42403
Aug 22, 2010 3:43
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.