views:

116

answers:

1
public class TheItemTemplate : ITemplate
{

    //....

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

Who calls this method? And when is it called?

+2  A: 

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.

Wim Hollebrandse