locked
Mobile Form backcolor problem RRS feed

  • Question

  • User153251611 posted

    Hi all,

    When I browse to a mobile web page using IE, the backcolor that appears is the one that the BackColor property is set to.

    When im using a mobile browser the backcolor is transperent. 

    I printed the Device.IsColor property and the result was True.

    For example:

     

     <%@ Page Language="C#" AutoEventWireup="true" CodeFile="testAspnet.aspx.cs" Inherits="testAspnet" %>

     <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>

     <html xmlns="http://www.w3.org/1999/xhtml" >

     <body>

     <mobile:Form id="Form1" runat="server" BackColor="Gray">

     <mobile:Label ID="Label1" Runat="server">Hello World</mobile:Label>

     </mobile:Form>

     </body>

     </html>

    Am I missing something?

     Thank you,

    Ami 

    Sunday, January 14, 2007 5:12 AM

All replies

  • User1307252949 posted

    Hi aminadav,

    I suspect that the reason you're unable to render a background colour is that the device my not be XHTML-compliant; it may only accept WML.

    WML has no such tag or attribute for setting the background colour. Strictly speaking, I don't think XHTML has either but most XHTML browsers will either probably allow this or they'll accept CSS (or perhaps the page renders with a <div> spanning the page/web form with a specific colour).

    The idea behind the mobile controls is that when the request is made to the server some of the device capabilities can be determined. The controls which you've placed on your form are then rendered/converted to match these capabilities. So if it's determined that your device cannot accept XHTML but will accept WML then the BackColor="Gray" attribute is dropped.

    Have you tried your mobile page on more than one device? 

    Tuesday, January 16, 2007 2:25 PM
  • User153251611 posted
    Hi,
     
    Im using nokia 6680 and nokia n73 for my tests.
    When I checked the supportsColor property of the MobileCapabilities class the result was true for both.
     
    Thank you,
     
    Ami
    Monday, January 22, 2007 3:36 PM
  • User1307252949 posted

    I think that supportsColor simply reflects whether the device has a colour screen or not, rather than whether the device will display a backgroundColour. If it's a WML device then it cannot display a backgroundColour.

    Coincidentally, until a couple of hours ago I would have claimed that the N73 should support XHTML and thereby a backgroundColour, but I was very recently looking at one of my own mobile webforms on an N73 and it only displayed the WML version and hence a white background (yes, even though it has a colour screen).

    My conclusion would be that the N73 cannot render XHTML which does surprise me as it's an otherwise up-to-date phone. One way to check this (apart from looking at the spec on the Nokia website) is to capture the HTTP request (which, from memory, is in the Server Variables collection) and look through this to see the formats that the device supports. It's from this HTTP request that the ASP.NET server determines which mark-up language to use.

    Monday, January 22, 2007 4:56 PM
  • User1430338353 posted

    Do you have access to Visual Studios 2003?

    Most of my  work is for display on Symbol scanners, which do have the capability of displaying BackColors. However, the Framework 2.0 pages I've made will not display a background color on them, only the 1.1 pages. I have not found a way around this. You could try making a page in VS 2003 to see if it shows up. That's probably not a great option to fix it, of course, but that might be the problem. I doubt you would want to revert just to fix that problem, but it might help you figure out what the issue is. And, if your issue is the same as mine, maybe you have more time in the day to actually find a solution. ;)

    Monday, January 29, 2007 2:50 PM