Home All Groups Group Topic Archive Search About
Author
15 Feb 2006 2:55 PM
Juan G.
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 are concerned:
....  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?

Author
15 Feb 2006 3:55 PM
Phillip Williams
Change your selectors syntax from ".cqi" and ".passing" to "tr.cqi td" and
"tr.passing td" respectively, e.g.

tr.cqi td
{
    font-weight: bold;
    font-size: 10pt;
    color: red;
    font-family: Verdana;
    background-color: black;
}
tr.passing td
{
    font-weight: bold;
    font-size: 10pt;
    color: #FFFFCC;
    font-family: Verdana;
    background-color: black;
}

Show quoteHide quote
"Juan G." wrote:

> 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 are concerned:
> ...  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?
>
>
Author
15 Feb 2006 4:45 PM
Juan G.
This worked. Thank you, Mr. Williams.

Show quoteHide quote
"Phillip Williams" wrote:

> Change your selectors syntax from ".cqi" and ".passing" to "tr.cqi td" and
> "tr.passing td" respectively, e.g.
>
> tr.cqi td
> {
>     font-weight: bold;
>     font-size: 10pt;
>     color: red;
>     font-family: Verdana;
>     background-color: black;
> }
> tr.passing td
> {
>     font-weight: bold;
>     font-size: 10pt;
>     color: #FFFFCC;
>     font-family: Verdana;
>     background-color: black;
> }
>
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "Juan G." wrote:
>
> > 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 are concerned:
> > ...  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?
> >
> >
Author
15 Feb 2006 5:26 PM
Phillip Williams
You are welcome.
Show quoteHide quote
"Juan G." wrote:

> This worked. Thank you, Mr. Williams.
>
> "Phillip Williams" wrote:
>
> > Change your selectors syntax from ".cqi" and ".passing" to "tr.cqi td" and
> > "tr.passing td" respectively, e.g.
> >
> > tr.cqi td
> > {
> >     font-weight: bold;
> >     font-size: 10pt;
> >     color: red;
> >     font-family: Verdana;
> >     background-color: black;
> > }
> > tr.passing td
> > {
> >     font-weight: bold;
> >     font-size: 10pt;
> >     color: #FFFFCC;
> >     font-family: Verdana;
> >     background-color: black;
> > }
> >
> > --
> > HTH,
> > Phillip Williams
> > http://www.societopia.net
> > http://www.webswapp.com
> >
> >
> > "Juan G." wrote:
> >
> > > 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 are concerned:
> > > ...  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?
> > >
> > >