We're running CMS 6 and need to create several instances Composer's ExtensionContentArea from code behind so we can access the generated HTML from the ExtensionContentArea with all <div> tags etc.
Normally, you have <Extension:ExtensionContentArea runat="server" ID="LeftArea" Description="The left area" /> in your Composer ascx file.
protected void Page_Load(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); StringWriter tw = new StringWriter(sb); HtmlTextWriter hw = new HtmlTextWriter(tw);
ExtensionContentArea content = new ExtensionContentArea(); content.Description = "The left area"; content.ID = "LeftArea"; content.DataBind(); content.RenderControl(hw); litExtensionContentArea.Text = sb.ToString(); }
Editing the page, the Composer block now appears in the content tab instead of the layout tab in Composer. However, when the page is rendered, the content of the ExtensionContentArea (rendered in litExtensionContentArea.Text) is empty.
Any advices on how to render the ExtensionContentArea from code behind?
We're running CMS 6 and need to create several instances Composer's ExtensionContentArea from code behind so we can access the generated HTML from the ExtensionContentArea with all <div> tags etc.
Normally, you have
<Extension:ExtensionContentArea runat="server" ID="LeftArea" Description="The left area" />
in your Composer ascx file.
In our case we have e.g.
Rendering the HTML from code ought to be:
protected void Page_Load(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
StringWriter tw = new StringWriter(sb);
HtmlTextWriter hw = new HtmlTextWriter(tw);
ExtensionContentArea content = new ExtensionContentArea();
content.Description = "The left area";
content.ID = "LeftArea";
content.DataBind();
content.RenderControl(hw);
litExtensionContentArea.Text = sb.ToString();
}
Editing the page, the Composer block now appears in the content tab instead of the layout tab in Composer. However, when the page is rendered, the content of the ExtensionContentArea (rendered in litExtensionContentArea.Text) is empty.
Any advices on how to render the ExtensionContentArea from code behind?