Dynamically Resolve Controls (inline widgets) in CMSUniVuew

SOS Childrensvillages asked on February 8, 2017 09:39

Hi,

I have a CMSUniView that I use to render a navigation menu.

However, I'm struggling to resolve inline widgets for same. I followed the documentation on how to dynamically resolve controls but as I'm inside a repeater it's throwing an exception saying the placeholder with id "plcPlaceholder" doesn't exist in the context (which I guess is down to the repeater creating multiple placeholders with the same ID).

Is there any way around this?

Thanks in advance

Correct Answer

Brenden Kehren answered on February 8, 2017 16:12

Think this might be your question here on SO as well. Take a look at the answer.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Trevor Fayas answered on February 8, 2017 16:00 (last edited on February 8, 2017 16:04)

My Apologies, i initially thought you were trying to just copy and paste inline control logic into a transformation. You may be able to use the CMS.MacroEngine.MacroContext.MacroResolver (may be slightly off on the name) to resolve the macro, and see if that works.

Otherwise if you are trying to add a Widget/webpart into a transformation, what you want to do is place an inline control in your transformation (the actual ascx) and configure it, or use the OnInit to set values.

<cms:CMSTextBox ID="MyControl" runat="server" />
<script runat="server">
    protected override void OnInit(EventArgs e)
    {
        MyControl.Text = "";
    }
</script>
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.