I'm trying to style the caption of a ASP.Net GridView in a C# file. here is my method that returns a styled GridView:
private GridView setupGridView(string caption)
{
var gview = new GridView()
{
BackColor = Color.White,
BorderColor = Color.Gray,
BorderStyle = BorderStyle.Solid,
BorderWidth = new Unit(1, UnitType.Pixel),
Caption = caption,
ForeColor = Color.Black,
};
gview.HeaderStyle.BackColor = Color.Navy;
gview.HeaderStyle.ForeColor = Color.White;
gview.HeaderStyle.BorderColor = Color.DarkGray;
gview.HeaderStyle.BorderWidth = new Unit(1, UnitType.Pixel);
gview.HeaderStyle.BorderStyle = BorderStyle.Solid;
gview.AlternatingRowStyle.BackColor = Color.LightGray;
return gview;
}
By default the Caption is not styled (it's just black text on top of the gridview)
Does anyone know how I can style the Caption Navy with white text? (similar to the way I have styled the header row maybe?)
EDIT: I've done this before by using CSS, but I don't have the liberty of doing that as, this is a program that generates gridviews to send in an email. There is no aspx file or skin...