Templates allow controls to make portions of their user interface configurable. Templates are used in classes like System.Web.UI.WebControls.DataList and can be added in your own custom controls by declaring properties of type ITemplate (for example, an ItemStyle or HeaderStyle property). This allows the user to specify a template for a portion of your control.
Your custom control code uses a supplied template by invoking the InstantiateIn( ) method. This method accepts a control reference and populates its Control.Controls collection with one or more server controls that represent the user interface defined in the template. The control you supply to the InstantiateIn( ) method could be the current control, or one of the current control's children. Note that you do not need to write the implementation code for this method, as the .NET framework provides it intrinsically.
public interface ITemplate { // Public Instance Methods public void InstantiateIn(Control container); }