CSS TD Tags
I have an ASP.NET DataGrid, in which I would like to implement Conditional
Formatting. I have figured out how to do this, insofar as the proper DataGrid
tags:
.... OnItemDataBound="ItemDataBoundEventHandler">, along with the
EventHandler:
Sub ItemDataBoundEventHandler(sender as Object, e as DataGridItemEventArgs)
Dim cqi as Integer
cqi = (DataBinder.Eval(e.Item.DataItem, "Score"))
If cqi < 80 then
e.Item.CssClass = "cqi"
Else
e.Item.CssClass = "passing"
End If
End Sub
I have linked my page to an external CSS Sheet, in which I have:
body
{
font-weight: bold;
color: #FFFFCC;
font-family: Arial;
background-color: black;
}
TD
{
font-weight: bold;
color: #FFFFCC;
font-family: Verdana;
font-size: 10pt;
background-color: black;
}
..cqi
{
font-weight: bold;
font-size: 10pt;
color: red;
font-family: Verdana;
background-color: black;
}
..passing
{
font-weight: bold;
font-size: 10pt;
color: #FFFFCC;
font-family: Verdana;
background-color: black;
}
This only works, however, when I remove the TD Style, in the above CSS
Sheet. The result, when I remove the TD Style, is that the DataGrid column
headings, along with Scores that are less than 80, are highlighted in Red,
which is what I want. However, when I put the "TD" sytle tags back into my
CSS Sheet, it does not work. I want to keep my "TD" Sytle tags. What should I
do?
date: Sun, 12 Feb 2006 13:57:27 -0800
author: Juan G.