TemplateContainer Class

Derived from the Panel class and used by ASP.NET to contain DeviceSpecificChoice templates.

Namespace: System.Web.UI.MobileControls
Assembly: System.Web.Mobile (in system.web.mobile.dll)

public ref class TemplateContainer : public Panel, INamingContainer
public class TemplateContainer extends Panel implements INamingContainer
public class TemplateContainer extends Panel implements INamingContainer

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

The following code example demonstrates how to use TemplateContainer objects to create templates within a DeviceSpecific object in a mobile form.

NoteNote

The following code sample uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code sample must be copied into an empty text file that has an .aspx extension. For more information on the Web Forms code model, see ASP.NET Web Page Code Model.

No code example is currently available or this language may not be supported.

All of the code above can be replaced declaratively with the following markup:

<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
    <mobile:Form id="Form1" runat="server">
        <mobile:DeviceSpecific Runat="server">
            <Choice Filter="isHTML32">
                <HeaderTemplate>
                    <mobile:Label ID="Label1" Runat="server">
                        Header Template - HTML32</mobile:Label>
                    <mobile:Command Runat="server">
                        Submit</mobile:Command>
                </HeaderTemplate>
                <FooterTemplate>
                    <mobile:Label ID="Label2" Runat="server">
                        Footer Template</mobile:Label>
                </FooterTemplate>
            </Choice>
            <Choice>
                <HeaderTemplate>
                    <mobile:Label ID="Label1" Runat="server">
                        Header Template - Default</mobile:Label>
                    <mobile:Command ID="Command1" Runat="server">
                        Submit</mobile:Command>
                </HeaderTemplate>
                <FooterTemplate>
                    <mobile:Label ID="Label2" Runat="server">
                        Footer Template</mobile:Label>
                </FooterTemplate>
            </Choice>
        </mobile:DeviceSpecific>
    </mobile:Form>
</body>
</html>

The Web.config file must have the following lines:

<!-- In Web.config file -->
<deviceFilters>
  <filter name="isHTML32" compare="PreferredRenderingType" argument="html32" />
</deviceFilters>

  • AspNetHostingPermission  for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
  • AspNetHostingPermission  for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.

System.Object
   System.Web.UI.Control
     System.Web.UI.MobileControls.MobileControl
       System.Web.UI.MobileControls.Panel
        System.Web.UI.MobileControls.TemplateContainer
           System.Web.UI.MobileControls.MobileListItem

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1

Community Additions

ADD
Show: