Datagrid: changing cell color

  • Thread starter Thread starter JR
  • Start date Start date
J

JR

Hello,
I've been successful changing general datagrid format
through the interface provided in VS.NET. Nice tool.

However, I now need to have different cells within a
datagrid have different background colors, depending on
the numerical value displayed in the cell. I can't
figure out how to do this.

Any suggestions appreciated.

thanks in advance,
JR
 
I suggest you check out TableStyles.

--
____________________________________
Bill Vaughn
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
its pretty simple by just coding the datagrids Itemdatabound event with
something like this:

If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
If e.Item.Cells(5).Text > 3 Then
e.Item.Cells(5).BackColor = Color.Red
Else
e.Item.Cells(5).BackColor = Color.Green
End If
End If
 
Back
Top