sticar
asked on
DataGrid CSS Style?
I just need a style for my datagrids... but all I'm getting is an all white background and black CG-Times letters. What I need is:
Header: Background=Gainsboro
Forecolor = 000086
Bold
Body: Background=White
Forecolor=000086
Footer: Same as header
Font = Arial
Here is what I have
-------------------------- ---------- -
.grid{
font-size: 10pt;
color: #000086;
background-color: White;
}
/* DataGrid header */
.grid_header{
color: Gainsboro;
background-color: #000086;
border-color:Gainsboro;
}
/* DataGrid items */
.grid_item{
background-color: white;
color: #000086;
}
/* DataGrid alternate items */
.grid_altitem{
background-color: white;
color: #000086;
border-color:Gainsboro;
}
/* DataGrid alternate items */
.grid_selitem{
background-color: #000086;
color: #000086;
border-color:Gainsboro;
}
<TD height="303"><asp:datagrid id="dgGrid" runat="server" Width="899px" GridLines="Vertical" AllowPaging="True"
PageSize="8" AllowCustomPaging="True" AutoGenerateColumns="False " CellPadding="4" BorderWidth="1px" BorderStyle="None" CssClass="grid">
<SelectedItemStyle Font-Bold="True" CssClass="grid_selitem"></ SelectedIt emStyle>
<AlternatingItemStyle CssClass="grid_altitem"></ Alternatin gItemStyle >
<ItemStyle CssClass="grid_item"></Ite mStyle>
<HeaderStyle CssClass="grid_header"></H eaderStyle >
<FooterStyle CssClass="grid_header"></F ooterStyle >
Header: Background=Gainsboro
Forecolor = 000086
Bold
Body: Background=White
Forecolor=000086
Footer: Same as header
Font = Arial
Here is what I have
--------------------------
.grid{
font-size: 10pt;
color: #000086;
background-color: White;
}
/* DataGrid header */
.grid_header{
color: Gainsboro;
background-color: #000086;
border-color:Gainsboro;
}
/* DataGrid items */
.grid_item{
background-color: white;
color: #000086;
}
/* DataGrid alternate items */
.grid_altitem{
background-color: white;
color: #000086;
border-color:Gainsboro;
}
/* DataGrid alternate items */
.grid_selitem{
background-color: #000086;
color: #000086;
border-color:Gainsboro;
}
<TD height="303"><asp:datagrid
PageSize="8" AllowCustomPaging="True" AutoGenerateColumns="False
<SelectedItemStyle Font-Bold="True" CssClass="grid_selitem"></
<AlternatingItemStyle CssClass="grid_altitem"></
<ItemStyle CssClass="grid_item"></Ite
<HeaderStyle CssClass="grid_header"></H
<FooterStyle CssClass="grid_header"></F
do you use css file or put this code in aspx?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I feel like such a dork! I was messing with this page trying to get a user control to work and I had stripped out the header information... I didn't think to look at it again, because it did change the color to white when I added the style to it!
Thanks!
Thanks!
You can look at here, it may help you..
http://msdn.microsoft.com/msdnmag/issues/04/01/CuttingEdge/default.aspx
https://www.experts-exchange.com/questions/20983483/datagrid-itemstyle.html
best of luck...
R.K