Share via


TemplateContainer Class

Inherits directly from the Panel class, which is used by ASP.NET mobile controls to create instances of templates inside it.

public class System.Web.UI.MobileControls.TemplateContainer :
   System.Web.UI.MobileControls.Panel,
   System.Web.UI.INamingContainer

Remarks

If a mobile control provides templated rendering features through device templates, it must create instances of each template inside a separate control of this type. In any data-binding expression is in a template, the Container variable is always of type TemplateContainer.

Example

This code example demonstrates how to use TemplateContainer objects to create scripting containers, header containers, and footer containers.

if (scriptTemplate != null)
{
  _scriptContainer = new TemplateContainer();
  scriptTemplate.InstantiateIn(_scriptContainer);
  _scriptContainer.EnablePagination = false;
}
if (headerTemplate != null)
{
  _headerContainer = new TemplateContainer();
  headerTemplate.InstantiateIn(_headerContainer);
  _headerContainer.EnablePagination = false;
  Controls.AddAt(0, _headerContainer);
}            
if (footerTemplate != null)
{
  _footerContainer = new TemplateContainer();
  footerTemplate.InstantiateIn(_footerContainer);
  _footerContainer.EnablePagination = false;
  Controls.Add(_footerContainer);
}

Requirements

Namespace: System.Web.UI.MobileControls

Assembly: System.Web.Mobile

See Also

DeviceSpecific Rendering | MobileListItem Class