Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Render ExtensionContentArea from code behind

Vote:
 

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.

<asp:Literal ID="litExtensionContentArea" runat="server"></asp:Literal>

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?

#61844
Oct 03, 2012 16:59
This thread is locked and should be used for reference only. Please use the Legacy add-ons 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.