locked
Setting background color of a row? RRS feed

  • Question

  • User-202103120 posted

     I am trying to set the background color of the heading row to a new color but don't know how to do it. In ASP.Net the only option seems to be the BackColor property of a control but it doesn't fills the entire row, only the part with the text. Can't find anything about it on the net either. Please help.

    Tuesday, August 19, 2008 5:19 AM

Answers

  • User-1113931457 posted

     Hi drkilljoy,

    i have come to a solution, not a solution exactly... you can say a workaround. here is the source code... give me your opinion

     Default3.aspx

    1    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
    2    <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
    3    
    4    <html xmlns="http://www.w3.org/1999/xhtml" >
    5    <body>
    6        <mobile:Form id="Form1" runat="server">
    7             <%--Fills Entire Row with background property--%>
    8            <mobile:DeviceSpecific Runat="server">
    9                <Choice Filter="isHTML32">
    10                   <HeaderTemplate>
    11                       <asp:Label ID="Label2" runat="server" BackColor="black" ForeColor="red" Font-Bold="true">Header Row For IE</asp:Label>
    12                   </HeaderTemplate>
    13               </Choice>
    14               <Choice Filter="IsMobile">
    15                   <HeaderTemplate>
    16                       <asp:Label ID="Label2" runat="server" BackColor="black" ForeColor="red" Font-Bold="true">Header Row For Mobile</asp:Label>
    17                   </HeaderTemplate>
    18               </Choice>
    19           </mobile:DeviceSpecific>
    20           <%-- Don't fills entire row with background property--%>
    21           <mobile:Label ID="Label1" Runat="server" BackColor="black" ForeColor="red" Font-Bold="true">Header Row</mobile:Label>
    22       </mobile:Form>
    23   </body>
    24   </html>
    25   
    
     
    web.config 
     <system.web>
    ...
        <deviceFilters>
          <filter name="isHTML32" compare="PreferredRenderingType" argument="html32" />
          <filter name="IsMobile" compare="IsMobileDevice" argument="true" />
        </deviceFilters>
    ...
    </system.web>  
     
    Thanks... 
       
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 22, 2008 2:32 PM

All replies

  • User-1113931457 posted

     Hi drkilljoy,

    i have come to a solution, not a solution exactly... you can say a workaround. here is the source code... give me your opinion

     Default3.aspx

    1    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
    2    <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
    3    
    4    <html xmlns="http://www.w3.org/1999/xhtml" >
    5    <body>
    6        <mobile:Form id="Form1" runat="server">
    7             <%--Fills Entire Row with background property--%>
    8            <mobile:DeviceSpecific Runat="server">
    9                <Choice Filter="isHTML32">
    10                   <HeaderTemplate>
    11                       <asp:Label ID="Label2" runat="server" BackColor="black" ForeColor="red" Font-Bold="true">Header Row For IE</asp:Label>
    12                   </HeaderTemplate>
    13               </Choice>
    14               <Choice Filter="IsMobile">
    15                   <HeaderTemplate>
    16                       <asp:Label ID="Label2" runat="server" BackColor="black" ForeColor="red" Font-Bold="true">Header Row For Mobile</asp:Label>
    17                   </HeaderTemplate>
    18               </Choice>
    19           </mobile:DeviceSpecific>
    20           <%-- Don't fills entire row with background property--%>
    21           <mobile:Label ID="Label1" Runat="server" BackColor="black" ForeColor="red" Font-Bold="true">Header Row</mobile:Label>
    22       </mobile:Form>
    23   </body>
    24   </html>
    25   
    
     
    web.config 
     <system.web>
    ...
        <deviceFilters>
          <filter name="isHTML32" compare="PreferredRenderingType" argument="html32" />
          <filter name="IsMobile" compare="IsMobileDevice" argument="true" />
        </deviceFilters>
    ...
    </system.web>  
     
    Thanks... 
       
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 22, 2008 2:32 PM
  • User-295291898 posted

    Try This...

    <table bgcolor="#60789e">
    <mobile:Form id="Form1" runat="server">
        <DeviceSpecific ID="dsLoc" Runat="server">
                <Choice Argument="html32" Filter="isHTML32" Xmlns="http://schemas.microsoft.com/mobile/html32template">
                        <HeaderTemplate>
                                <tr>
                                        <td align="left">
                                                <mobile:Label ID="Label1" Runat="server"></mobile:Command>
                                            </td>
                    </tr>
                            </HeaderTemplate>
                <ItemTemplate>
                    <tr bgcolor="#F7F6F3">
                                        <td valign="Top">
                                                <mobile:Label ID="Label2" Runat="server"></mobile:Command>
                        </td>
                    </tr>
                </ItemTemplate>
            </Choice>
        </DeviceSpecific>
    </mobile:Form>
    </table>

     

    use bgcolor attribute of the <tr> or <td>..

    Thanks,

    Wednesday, August 27, 2008 6:58 AM