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

Discussion in 'ASP .Net Datagrid Control' started by RJ, Feb 18, 2005.

  1. RJ

    RJ Guest

    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;
    }
    RJ, Feb 18, 2005
    #1
    1. Advertising

  2. It looks ok. You might have another style overriding the one you are
    setting.

    Eliyahu

    "RJ" <> wrote in message
    news:...
    > 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;
    > }
    >
    >
    Eliyahu Goldin, Feb 18, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    526
  2. George Jordanov Ivanov

    Literal control doesn't have CssClass property?

    George Jordanov Ivanov, Mar 30, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    15,377
    WarNov
    Sep 13, 2006
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,842
    Smokey Grindel
    Dec 2, 2006
  4. Joel Finkel

    Cells[].Text or Cells[].Controls[0]

    Joel Finkel, Sep 1, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    307
    Joel Finkel
    Sep 1, 2003
  5. Sky
    Replies:
    2
    Views:
    281
    Robert Koritnik
    Oct 1, 2004
Loading...

Share This Page