Panel.Content Panel.Content Panel.Content Panel.Content Property


Returns a panel containing device-specific content. A content template must be defined and chosen for the target device. This API is obsolete. For information about how to develop ASP.NET mobile applications, see Mobile Apps & Sites with ASP.NET.

 property System::Web::UI::MobileControls::Panel ^ Content { System::Web::UI::MobileControls::Panel ^ get(); };
public System.Web.UI.MobileControls.Panel Content { get; }
member this.Content : System.Web.UI.MobileControls.Panel
Public ReadOnly Property Content As Panel

Property Value

The panel containing device-specific panel content.


The following code example demonstrates how to use the Content property to find a control when the page loads.


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, see ASP.NET Web Forms Page Code Model.

<%@ Page Language="C#" 
    Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" 
    Assembly="System.Web.Mobile" %>
<%@ Import Namespace="System.Drawing" %>

<script runat="server">
    public void Page_Load(Object sender, EventArgs e)
        // Set Panel1 properties
        Panel1.Wrapping = Wrapping.NoWrap;
        Panel1.Alignment = Alignment.Center;
        Panel1.StyleReference = "title";

        // Find Label in Panel2
        Control ctl = Panel2.Content.FindControl("lblStatusToday");
        if (ctl != null)
                = "I found this label";
    public void MakeFontRed(Object sender, EventArgs e)
        Panel1.ForeColor = Color.Red;
    public void MakeFontBlue(Object sender, EventArgs e)
        Panel1.ForeColor = Color.Blue;

<html xmlns="" >
<mobile:Form runat="server" id="Form1">
    <!-- First Panel -->
    <mobile:Panel runat="server" id="Panel1">
        <mobile:TextView runat="server" id="TextView1">
            A Panel provides a grouping mechanism<br />
            for organizing controls.
    <mobile:Command runat="server" id="Command1"  BreakAfter="false"
        Text="Make Font Red" OnClick="MakeFontRed"/>
    <mobile:Command runat="server" id="Command2" BreakAfter="true"
        Text="Make Font Blue" OnClick="MakeFontBlue"/>

    <!-- Second Panel -->
    <mobile:Panel ID="Panel2"  Runat="server">
        <mobile:DeviceSpecific id="DeviceSpecific1" runat="server">
            <!-- Filter and template for HTML32 devices -->
            <Choice Filter="isHTML32" 
                    <mobile:Label id="Label1" runat="server">
                        HTML32 Template</mobile:Label>
                    <mobile:Label ID="lblStatusToday" Runat="server"/>
            <!-- Default filter and template -->
                    <mobile:Label ID="Label1" Runat="server">
                        Default Template</mobile:Label>
                    <mobile:Label ID="lblStatusToday" Runat="server" />

You will also need to add this section to your Web.config file:

Applies to

See also