How to set cell background based on cell value when datagrid is displayed

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

  1. RJ

    RJ Guest

    I would like to check a datagrid cell value, and change the color of the
    cell background, when a datagrid is displayed. I want to do this as early
    as possible after / during a page load event. I tried looking into the
    DataBinding event of the datagrid, but couldn't see how to get the
    individual cells out of the EventArg passed into the DataBinding handler. I
    am hoping this can be done in a VB.net code-behind class and not require
    editing of the HTML to accomplish this. Thanks for any insights.

    RJ
     
    RJ, Feb 17, 2005
    #1
    1. Advertising

  2. Second parameter passed to the event handler has type of
    DataGridItemEventArgs. It has property Item which represents a datagrid row.
    It has in turn property Cells which is what you are after.

    Eliyahu

    "RJ" <> wrote in message
    news:...
    > I would like to check a datagrid cell value, and change the color of the
    > cell background, when a datagrid is displayed. I want to do this as early
    > as possible after / during a page load event. I tried looking into the
    > DataBinding event of the datagrid, but couldn't see how to get the
    > individual cells out of the EventArg passed into the DataBinding handler.

    I
    > am hoping this can be done in a VB.net code-behind class and not require
    > editing of the HTML to accomplish this. Thanks for any insights.
    >
    > RJ
    >
    >
     
    Eliyahu Goldin, Feb 17, 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. Rob Rogers
    Replies:
    3
    Views:
    728
    Rob Rogers
    Jul 15, 2004
  2. Anna
    Replies:
    1
    Views:
    365
    Joe Fallon
    Feb 26, 2005
  3. boney
    Replies:
    1
    Views:
    568
  4. Nicolaj

    Set maximum Rows to be displayed in a datagrid

    Nicolaj, Aug 13, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    4
    Views:
    214
  5. James Radke

    Set repeater row background color based on data value - how?

    James Radke, Jan 20, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    1,614
    Jeffrey Tan[MSFT]
    Jan 21, 2004
Loading...

Share This Page