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).
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