PRB: Header and Footer Templates Are Rendered Differently in Web User Controls (310301)
The information in this article applies to:
- Microsoft Mobile Internet Toolkit (MMIT)
This article was previously published under Q310301 SYMPTOMS
When you are using a Web user control that contains a DeviceSpecific control with a header and a footer template, the header and footer template is not rendered in the correct place when you browse the page. Instead, the templates are rendered in the location where you place the user control in a mobile Web Forms page instead of in the header and footer locations of the Web Form.
RESOLUTION
To resolve this behavior, instead of a DeviceSpecific control, use an external style sheet that contains a header and a footer template.
The following code sample is an example of a Web user control that contains a mobile style sheet:
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<mobile:StyleSheet id="StyleSheet1" runat="server">
<Style Name="myHeaderStyle">
<DeviceSpecific>
<Choice Filter="isWML11">
<HeaderTemplate>
<mobile:Label id=Label1 runat="server">WML Header Template</mobile:Label>
</HeaderTemplate>
<FooterTemplate>
<mobile:Label id="Label2" runat="server">WML Footer Template</mobile:Label>
</FooterTemplate>
</Choice>
<Choice Filter="isHTML32">
<HeaderTemplate>
<mobile:Label id=Label1 runat="server">HTML Header Template</mobile:Label>
</HeaderTemplate>
<FooterTemplate>
<mobile:Label id="Label2" runat="server">HTML Footer Template</mobile:Label>
</FooterTemplate>
</Choice>
</DeviceSpecific>
</Style>
</mobile:StyleSheet>
The following code sample is an example of a mobile Web Form that uses an external style sheet:
<%@ Page language="c#" Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<mobile:Form id="Form1" runat="server" StyleReference="myHeaderStyle">
<mobile:Label id="Label3" runat="server">Some Content</mobile:Label>
</mobile:Form>
<mobile:StyleSheet id="StyleSheet1" runat="server" ReferencePath="myStyles.ascx">
</mobile:StyleSheet>
STATUSThis behavior is by design.
Modification Type: | Major | Last Reviewed: | 6/14/2002 |
---|
Keywords: | kbDeviceSpecific kbDSupport kbprb kbServerControls kbtemplate KB310301 |
---|
|