views:

2842

answers:

3

Hello Friends

I am using asp.net c#. I am using gridview to display the data. i am controlling all formating through CSS. In gridview i have define itemtemplate + edititemtemplate + footertemplate and doing sorting through bind column at template field. My problem is the column name which dispalay as header that color is not changed through CSS, font size,type all things going ok but fore color is fix as Blue is any body help me out how can i change forecolor of header which is allow to sorting.

My code looks like : asp:TemplateField HeaderText="Slsmn No." HeaderStyle-CssClass="GridHeaderStyle" SortExpression="Profile_Var"

Problem is "Slsmn No." Display blue color and under line but in css i gave color:red

Thanks

+1  A: 

Hi Kartik--

The CSS class you've assigned (GridHeaderStyle) is being applied to the header cells, not the header links. It sounds like the default link color is being applied.

Add the following to your CSS file:

.GridHeaderStyle a {color: red;}

This should change the link color in the headers.

Hope this helps!

Jeremy Kratz
+1  A: 

At first I tried Jeremy's solution, but it didn't work for me. This is because the .asp code generated forces a <style="color: #333333"> tag in the header when you make it sortable.

Here's how to solve the problem:

.GridHeaderStyle a {color: white!important}

The !important qualifier will override the style that asp puts in.

garrett
A: 

This happens because you have not defined a CSS rule which says anything about the link color.

Add the following to your stylesheet:

.GridHeaderStyle a {
    color: #f0f; /* or whatever */
}
Deniz Dogan