Click to See Complete Forum and Search --> : GridView ForeColor not displaying properly


STEVESKI07
04-11-2008, 08:25 AM
I'm having difficulty getting the ForeColor property of my gridview header to print the right color. Im declaring it as white, but it's displaying in black. I think I remember fixing a problem like this before, but it was a while back and I can't remember what I did. I'm programmatically populating this gridview and I remember that has something to do with it. Here's my code:

<asp:GridView ID="dvStaff" runat="server" AllowPaging="True" PageSize="10">
<PagerSettings NextPageText="Next Page" PreviousPageText="Previous Page" />
<FooterStyle BackColor="White" ForeColor="#333333" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#5E000A" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#5E000A" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" />
</asp:GridView>

Any suggestions? Thanks in advance!

-Steve

STEVESKI07
04-11-2008, 11:35 AM
I'll spend hours trying to solve a problem and then finally give up and post on here. Within 20 minutes of posting on here, I solve my problem. This place is good luck. Sorry for the wasted thread, but if anyone else comes across this problem, you need to add this to the code behind after the datasource has been bound to the gridview:

For i = 0 To dvStaff.Rows(0).Cells.Count() - 1
dvStaff.HeaderRow.Cells(i).ForeColor = Color.White
Next