Try our conversational search powered by Generative AI!

Determine property name from DynamicContentPlugIn instance


I have WebControl that inherits from UserControlBase lets call it "MyDynamicControl",

I have specified attribute for it: DynamicContentPlugIn.


The question is: from DynamicContentPlugIn control how can I determine name of property in what this instance resides?


Why I need this:

For example in property named "A" I add "MyDynamicControl", that displays content from property "B", and it works fine.

But if user places "MyDynamicControl" inside property named "A" and configures to display property "A"(the same property) then infinite loop happens(and it should happen).


Nov 25, 2011 13:25

Probably may not working in all cases but this code snippet gave me outer property name in which dynamic content control is included (code behind of .ascx user control).


var container = BindingContainer;
if (container != null)
    var mainContainer = container.BindingContainer as EPiServer.Web.WebControls.Property;
    if(mainContainer != null)
        // you logic here


Edited, Nov 27, 2011 19:33
* 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.