November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi Rachappa!
Im not sure what you mean by "placing" a DC "inside" another?
Does _your_ DC contain a PropertyXhtmlString for the description, and while editing this you select the other DC?
If so, then how do _your_ DC render itself?
I think it *should* work if your DC specifies RendersWithControl == true and in the implementaion of GetControl()
instantiates a EPiServer:Property, assigns the PropertyXhmlString to it and simply returns that.
But, I havent tested this myself...
/johan
A test could be to check if it works if you use the "Property from other page" dynamic content and select a property which contains other dynamic content. If that works there's no general problem with nested dynamic content.
You can nest DynamicContent elements inside one another. I've been involved in an implementation that does exactly that, as a means of providing some conditional content for export into another system.
It works similarly to how Johan mentions - the DynamicContent sets RendersWithControl == true and our GetControl method returns a Literal control with the rendered output of the Xhtml Property assigned to it. The reason we return a Literal is because we also wanted to return some other output along with the XhtmlPropertyValue (I've omitted this from the code below).
public override Control GetControl(PageBase hostPage)
{
var ctrl = new PropertyLongStringControl { PropertyData = _propertyValue };
ctrl.SetupControl();
var stringWriter = new StringWriter();
var htmlWriter = new HtmlTextWriter(stringWriter);
ctrl.RenderControl(htmlWriter);
return new LiteralControl(htmlWriter.ToString());
}
Hello Folks,
Thanks for the quick response. Here are the details,
There are 2 dyanmiccontent (DC), one has 3-4 episerver properties and also there is one control thats been used, where as the other DC has only one field and no controls is associated with that so when render method is called we are just rendering a string from the session.
So in First DC in one property field i have dropped second DC, so whenever the page calls first DC it inturn calls the second DC, but when it doesn't render. It renders as plain text itself {DynamicContent:Description}
But if i drop second DC seperately then it is rendered properly. If i tie both it is not working. It's nothing but Nested DynamicContent
Please let me know if you guys were able to underestand
Thanks
Rachappa
I haven't tried any of this myself, but it seems to me that your situation is very similar to Mark's. As he wrote he omitted the lines where additional controls were rendered. You could just do the same and render everything into the same HtmlTextWriter in sequence and it should work.
Another alternative that I imagine is to use Johan's approach with letting the PropertyControl render itself. If you need to combine several controls (property controls or others) you should be able to just add those to a placeholder control and return the placeholder control.
Hi Anders, it isn't just you! You could just return the control. I was just a bit lazy when it came to formatting the code above, as in our original implementation we also appended some other information to the rendered PropertyLongStringControl output before returning a Literal control instanstiated with the string.
Hello,
We are facing one issue. We created a DynamicContent which show some description. Inside that DC i placed one more dynamic Content to display Name of the Product. But at runtime it displays DyanmicContent:Name. I think it is a bug in Episerver where nesting of dynamiccontent is not allowed?
Please comment on this.
Thanks
Rachappa