User Control Page /MobileModuleTitle.ascx (C#)
1: <%@ Control %>
2: <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
3: <%@ Import Namespace="ASPNetPortal" %>
4:
5: <%--
6:
7:     The MobileModuleTitle User Control is responsible for displaying the title of  
8:     each portal module within the mobile portal. It include device-specific
9:     templates for richer rendering of the title on Pocket PCs.
10:
11: --%>
12:
13: <script language="C#" runat="server">
14:
15:     public String Text;
16:     
17:     //*********************************************************************  
18:     //  
19:     // Page_Load Event Handler  
20:     //  
21:     // The Page_Load event handler executes after the user control is loaded  
22:     // and inserted into the control tree.  
23:     //  
24:     // The Page_Load event handler checks to see if  
25:     //  
26:     //*********************************************************************  
27:
28:
29:     void Page_Load(Object sender, EventArgs e) {
30:     
31:         if (Text == null) {
32:         
33:             // If the Text property has not been explicitly specified,  
34:             // walk the parent control chain to find a MobilePortalModuleControl,  
35:             // and obtain the title from the corresponding module.  
36:         
37:             MobilePortalModuleControl module = null;
38:             Control control = this;
39:             
40:             while (module == null && (control = control.Parent) != null) {
41:                 module = control as MobilePortalModuleControl;
42:             }
43:                     
44:             Text = module.ModuleTitle;
45:         }
46:     
47:         // Databind the User control.  
48:         DataBind();
49:     }
50:     
51: </script>
52:
53: <mobile:Panel runat="server">
54:     <DeviceSpecific>
55:         <Choice Filter="isJScript">
56:             <ContentTemplate>
57:                 <font face="Verdana" size="-1" color="#666633"><b>
58:                         <%# Text %>
59:                     </b></font>
60:                 <br>
61:                 <hr noshade size="1pt" color="#666633">
62:             </ContentTemplate>
63:         </Choice>
64:     </DeviceSpecific>
65:     <mobile:Label runat="server" ForeColor="#666633" Font-Size="Large" Font-Bold="True">
66:         <%# Text %>
67:     </mobile:Label>
68: </mobile:Panel>