Erik Marcussen
1/9/2002 11:49:00 AM
Hi
In our mobile application all titles and text on the pages are retrieved
from a database in order to support several languages. We have an external
stylesheet that makes it look better on PocketPC. An example of a style
within this sheet is attached below.
Thus what we want is to have programatically access to the lblHeader label
so that we can set the text property.
I have found out how to get access to the stylesheet and the style from a
page that uses the stylesheet in this way (c#):
System.Web.UI.MobileControls.StyleSheet stylesheet;
// get the stylesheet
stylesheet =
(System.Web.UI.MobileControls.StyleSheet)GeneralSheet.Controls[0].FindContro
l("GeneralStyles");
// get the style
System.Web.UI.MobileControls.Style style = stylesheet["STAFFDIRECTORY"];
style.DeviceSpecific.Choices[0].Templates["HeaderTemplate"];
// this object is of type CompiledTemplateBuilder and cannot be used, what I
need is the HeaderTemplate
// container and hence its controls / the label
<Style Name="STAFFDIRECTORY" StyleReference="FORM">
<mobile:DeviceSpecific id="StaffSpecific" Runat="server">
<Choice Filter="isHTML32">
<HeaderTemplate id="head">
<table width="250" cellspacing="0" border="0">
<tr>
<td align="center" bgcolor="#660066">
<font face="verdana" color="white">
<b>
<asp:Label Runat=server ID="lblHeader">Staff Directory</asp:Label>
</b>
</font>
</td>
</tr>
<tr>
<td valign=middle>
</HeaderTemplate>
<FooterTemplate id=foot>
</td>
</tr>
</table>
</FooterTemplate>
</Choice>
</mobile:DeviceSpecific>
</Style>