locked
Color RRS feed

  • Question

  • User-1097933300 posted

    Hey all,

    Does anyone know how to make a price of text in a mobile form have a background color?

    Thanks!

    Tuesday, April 10, 2007 8:25 AM

Answers

  • User1634317999 posted

    I found the answer why the BackColor attribute is not rendered for the peferredRenderingType Html32, e. g. Internet Explorer, Internet Explorer Mobile: HTML 3.2 does not allow an implementation of a background color, except the bgcolor attribute of the body tag.

    This post explains a workaround:

    <mobile:Panel ID="Panel1" Runat="server">
                <mobile:DeviceSpecific ID="DeviceSpecific1" Runat="server">
                    <Choice Filter="isHTML32" Xmlns="http://schemas.microsoft.com/mobile/html32template">
                        <ContentTemplate>
                            <span style="background: #FF8000;"><mobile:Label ID="Label1" Runat="server">Test-Label BackColor HTML32</mobile:Label></span>
                        </ContentTemplate>
                    </Choice>
                    <Choice Xmlns="http://schemas.microsoft.com/mobile/html32template">
                        <ContentTemplate>
                            <mobile:Label ID="Label2" Runat="server" BackColor="#FF8000">Test-Label BackColor XHTML-MP</mobile:Label>
                        </ContentTemplate>
                    </Choice>
                </mobile:DeviceSpecific>
            </mobile:Panel>
     

    The other workaround is to default the whole mobile application to XHTML:

    <?xml version="1.0" ?>
    <configuration>
    <system.web>
    <browserCaps>
          preferredRenderingMime = "text/html"
          preferredRenderingType = "xhtml-mp"
    </browserCaps>
    </system.web>
    </configuration>
    
     

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, April 21, 2007 3:10 PM

All replies

  • User1634317999 posted
    You have to set the BackColor attribute.
    Friday, April 20, 2007 3:09 AM
  • User731069546 posted

    Even though BackColor attribute is present, it is not used when the mobile control is rendered. That's why you don't see the back ground color in your case.

    Friday, April 20, 2007 11:50 AM
  • User1634317999 posted

    The BackColor is rendered for the Mobile Form Control, i. e. the body background color, in all all markup languages. For other controls like Label, Link or TextView it is only rendered in XHTML. And I don't know why at the moment.  If you use a device for that the Mobile Controls output XHTML-MP you will see the BackColor. Therefore it depends on the configured device profiles if BackColor is rendered.

    Friday, April 20, 2007 3:40 PM
  • User1634317999 posted

    I found the answer why the BackColor attribute is not rendered for the peferredRenderingType Html32, e. g. Internet Explorer, Internet Explorer Mobile: HTML 3.2 does not allow an implementation of a background color, except the bgcolor attribute of the body tag.

    This post explains a workaround:

    <mobile:Panel ID="Panel1" Runat="server">
                <mobile:DeviceSpecific ID="DeviceSpecific1" Runat="server">
                    <Choice Filter="isHTML32" Xmlns="http://schemas.microsoft.com/mobile/html32template">
                        <ContentTemplate>
                            <span style="background: #FF8000;"><mobile:Label ID="Label1" Runat="server">Test-Label BackColor HTML32</mobile:Label></span>
                        </ContentTemplate>
                    </Choice>
                    <Choice Xmlns="http://schemas.microsoft.com/mobile/html32template">
                        <ContentTemplate>
                            <mobile:Label ID="Label2" Runat="server" BackColor="#FF8000">Test-Label BackColor XHTML-MP</mobile:Label>
                        </ContentTemplate>
                    </Choice>
                </mobile:DeviceSpecific>
            </mobile:Panel>
     

    The other workaround is to default the whole mobile application to XHTML:

    <?xml version="1.0" ?>
    <configuration>
    <system.web>
    <browserCaps>
          preferredRenderingMime = "text/html"
          preferredRenderingType = "xhtml-mp"
    </browserCaps>
    </system.web>
    </configuration>
    
     

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, April 21, 2007 3:10 PM
  • User1777321731 posted

    Hi,

    This is Amit Shah. I am very new to .Net Mobile development. I am using .Net 2005 for developing mobile application. My problem is preety similar to this thread. Even i am not able to get the background color or even i can say not able to apply external or internal css stylesheet in my any mobile form. I have applied the last solution in my app but then i cam see background color on Internet Explorer 6 but not on the emulators or mobile phones.

     Please help me out on this because i am out of solutions now [:'(]

     

    Thanks in Advance,

    Amit Shah

    Friday, July 27, 2007 2:42 AM
  • User1900435586 posted

    hi  toamitshah

                             

    </system.web>

    <browserCaps>

    preferredRenderingMime = "text/html"

    preferredRenderingType = "xhtml-mp"

    </browserCaps>

    <mobileControls allowCustomAttributes="true" />

    </system.web>

                   and use the basic color like Red, blue and green as background color.

     

    Thursday, September 6, 2007 4:08 AM