Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setting gridview header color

i am working in asp.net and c# i have a grid view. i have 10 columns in that grid view. I have some problems with grid view header text color. some of the columns header have link (for sorting). the color of such header text is a light blue.after clicking the blue color change to another color.

some of columns header does not have link. the color of such header text is gray.

i want to make the color of entire header text to single color like gray. after clicking the link it must be in same color. thanks in advance

like image 264
Null Pointer Avatar asked Oct 13 '10 07:10

Null Pointer


2 Answers

You may define css class in your css file. After defined your class, you may set your grid CssClass property with your class name. For ex.;

.GridStyle
{
    border: 6px solid rgb(217, 231, 255);
    background-color: White;
    font-family: arial;
    font-size: 12px;
    border-collapse: collapse;
    margin-bottom: 0px;
}
.GridStyle tr
{
    border: 1px solid rgb(217, 231, 255);
    color: Black;
    height: 25px;
}
/* Your grid header column style */
.GridStyle th
{
    background-color: rgb(217, 231, 255);
    border: none;
    text-align: left;
    font-weight: bold;
    font-size: 15px;
    padding: 4px;
    color:Black;
}
/* Your grid header link style */
.GridStyle tr th a,.GridStyle tr th a:visited
{
        color:Black;
}
.GridStyle tr th, .GridStyle tr td table tr td
{
    border: none;
}

.GridStyle td
{
    border-bottom: 1px solid rgb(217, 231, 255);
    padding: 2px;
}
like image 120
ismailperim Avatar answered Sep 23 '22 10:09

ismailperim


You can apply styles and css classes to different elements of a GridView rather than just applying a css class to the main GridView.

<AlternatingRowStyle CssClass="style1" />
<RowStyle CssClass="style2" />
<HeaderStyle CssClass="style3" />
<FooterStyle CssClass="style4" />
<SelectedRowStyle CssClass="style5" />

If you look at the HTML which is generated for the GridView, you can then identify which elements are given the classes, then from this you can apply any styling you wish.

Mainly styling tr, th, td within the table.

like image 36
Tim B James Avatar answered Sep 21 '22 10:09

Tim B James