Monday, February 18, 2008

Set GridView Header Font Style in CSS

I have defined my GridView header style in CSS. Because I've set my GridView to be sortable, so the header texts will be links, and it'll follow the style of Links as defined.

I'd like to change the header text color to fit to header row color, and finally I've found the solution.

Define the CSS like this:

tr.OrangeGridViewHeader, 
tr.OrangeGridViewHeader a:visited,
tr.OrangeGridViewHeader a:link
{
background-color:#feaa66;
font-family:Verdana;
font-weight: bold;
color:#000;
text-decoration:none;
}

tr.OrangeGridViewHeader a:hover
{
background-color:#feaa66;
font-family:Verdana;
font-weight: bold;
color:#000;
text-decoration:underline;
}



 


Then set the HeaderStyle's CssClass to OrangeGridViewHeader. It's done! Happy