Setting gridview header color

asp.netgridview

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

Best Answer

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;
}
Related Topic