locked
header row gridvew RRS feed

  • Question

  • User-1499457942 posted

    Hi

      I have adminlte.css . I want Gridview Header row Forecolor = White , Background Color = Blue

    .table-striped > tbody > tr:nth-child(odd) > td,
    .table-striped > tbody > tr:nth-child(odd) > th{
    background-color: #cccccc;

    }

    Thanks

    Thursday, December 20, 2018 2:25 PM

All replies

  • User-1174608757 posted

    Hi JagjitSingh,

    According to your description I have made a sample here. Gridview will be rendered into a table when it finally shows in browser.Its header row is essentially  th of the table.So it makes conflict that you both set the Header row background-color and th color.I guess you want the head row color is blue and content row color is white-grey.I have made a sample here, I hope it can help you.

    Gridview.aspx:

    <head runat="server">
        <link href="../Content/bootstrap.css" rel="stylesheet" />
        <title></title>
        <style>
            .adminlte th {
                color:white ;
                background-color:blue;
                
            }
            .table-striped>tbody>tr:nth-child(odd)>td {
              
                background-color:#cccccc;
            }
            
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>           
                <asp:GridView ID="GridView1" runat="server" CssClass="adminlte table-striped" Height="310px" Width="355px" >
    
                </asp:GridView>
            </div>
        </form>
    </body>
    </html>

    It shows as below:

    Friday, December 21, 2018 2:53 AM