Home All Groups Group Topic Archive Search About

Why doesn't the CssClass property change the visual display of my datagrid cells?

Author
18 Feb 2005 2:52 AM
RJ
Why doesn't the CssClass property change the visual display of my datagrid
cells?  Thanks for any insights.  I'm primarily a developer of .NET business
components, and weak in ASP.NET, so I may very well be missing some key
ingredient here.

' Yes, the ItemDataBound event is handled for each row in datasource......
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemDataBound

' Yes,  FormatCells does get called for each row.....
        FormatCells(sender, e)



Protected Sub FormatCells(ByVal sender As System.Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs)

' Yes, this line of code is executed, but has no visual effect when the
datagrid is displayed.
' What more must I do to have this CssClass apply?
e.Item.CssClass = "MyWarning"
..
..
..
' Yes, In Styles.css the class is defined....

..MyWarning
{
color: red;
}

Author
18 Feb 2005 11:41 AM
Eliyahu Goldin
It looks ok. You might have another style overriding the one you are
setting.

Eliyahu

Show quoteHide quote
"RJ" <R*@PostOnly.com> wrote in message
news:eToifTWFFHA.2156@TK2MSFTNGP10.phx.gbl...
> Why doesn't the CssClass property change the visual display of my datagrid
> cells?  Thanks for any insights.  I'm primarily a developer of .NET
business
> components, and weak in ASP.NET, so I may very well be missing some key
> ingredient here.
>
> ' Yes, the ItemDataBound event is handled for each row in datasource......
>  Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.DataGridItemEventArgs) Handles
> DataGrid1.ItemDataBound
>
> ' Yes,  FormatCells does get called for each row.....
>         FormatCells(sender, e)
>
>
>
> Protected Sub FormatCells(ByVal sender As System.Object, ByVal e As
> System.Web.UI.WebControls.DataGridItemEventArgs)
>
> ' Yes, this line of code is executed, but has no visual effect when the
> datagrid is displayed.
> ' What more must I do to have this CssClass apply?
> e.Item.CssClass = "MyWarning"
> .
> .
> .
> ' Yes, In Styles.css the class is defined....
>
> .MyWarning
> {
>  color: red;
> }
>
>