locked
BackColor not working RRS feed

  • Question

  • User1940915775 posted
    The asp.net mobile controls Label has a backcolor property. How do I get that to be passed through to the markup that gets sent to the client?

    Consider this:
     
            <mobile:Label ID="Label4" Runat="server" BackColor="blue">Label Text</mobile:Label>

    this color doesn't get applied client side, even if I go to the site with a desktop browser, which should be detected as supporting that sort of thing.

    What am I doing wrong?

    Thanks
    Wednesday, April 5, 2006 7:19 PM

All replies

  • User-1821883683 posted
    I was troubled by this problem, too. Need help!
    Thursday, April 6, 2006 11:02 AM
  • User-1963647621 posted
    Same problem on my side.. please if anybody knows why it aint workin.. tell us WHY? and if there is a possible work around.
    Sunday, April 9, 2006 10:43 AM
  • User-1963647621 posted
    Same here.. i am facing the same problem.
    Sunday, April 9, 2006 10:43 AM
  • User1992647513 posted

    I have the same problem

    Monday, July 10, 2006 9:33 AM
  • User1625204979 posted

    well, a quick (but not elegant) workaround is to specify device specific content to write out a span tag with the background around the label:

        <mobile:Panel runat=server>
            <DeviceSpecific>
                <Choice Filter="isHTML32">
                    <ContentTemplate>
                        <span style="background:white">
                    </ContentTemplate>
                </Choice>
            </DeviceSpecific>
        </mobile:Panel>
       
        <mobile:Label ID="Label4" Runat="server" BackColor="blue" ForeColor="green" >Label Text</mobile:Label>
       
        <mobile:Panel runat=server>
            <DeviceSpecific>
                <Choice Filter="isHTML32">
                    <ContentTemplate>
                        </span>
                    </ContentTemplate>
                </Choice>
            </DeviceSpecific>
        </mobile:Panel>

    Note that the filter "isHTML32" is from the default mobile web.config that can be created in Visual Studio.

    A better solution would be adding a new adapter to inherit and override HtmlLabelAdapter.Render method to write out the background style.

    Friday, July 14, 2006 9:24 PM
  • User-1208438202 posted

    Hi

      i am also facing the same problem....

     pls anybody know... help me out in this issue..

     

    Wednesday, August 30, 2006 4:29 AM
  • User33524104 posted

    Anyone got any solution for this problem?

    Monday, December 11, 2006 3:35 PM
  • User752049302 posted

    It also depends on the device recognition by .net and the profiles you have on server (see the sticky post up top).

     This workaround (I use a similar approach) will only work if .net detects the mobile device as a HTML32 device.. and without the above-mentioned profiles, .net detects my N70 as a WML phone..

     I made a post about this problem before, but no luck finding a way to share profiles among developers.
     

    Tuesday, December 12, 2006 8:31 AM
  • User-30447372 posted

    Looks like it's not rendering correctly. Same thing happen with Panel's back color.

    And in textbox also, some style doesn't work.

     

    Solution: Need to override render method as explained by Frank. (didn't try yet, but once i m done, i will update here)

     

    Thursday, December 14, 2006 3:45 PM
  • User-594538140 posted

    Can anyone tell me how to set backcolor for lable and panel I am facing the same problem

    Tuesday, October 21, 2008 8:36 AM
  • User2024195434 posted

    Somebdy help us all. We are the sufferers

    Tuesday, March 24, 2009 7:07 AM
  • User2095893553 posted

    Help, I have the same issue.

    Monday, December 5, 2011 4:56 PM