Question

public class TheItemTemplate : ITemplate
{

    //....

    public void InstantiateIn(Control container)
    {
        //...
    }
}

Who calls this method? And when is it called?

Was it helpful?

Solution

Typically, this method is called when the control tree is created, so in the CreateChildControls() method. This CreateChildControls method is part of the Control inheritance hierarchy and is typically overriden by subclassed controls.

So, the control to which the template belongs should call InstantiateIn() in CreateChildControls.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top