G
Guest
I'm trying to use a datagrid to display data and that has been easy - what
i'm trying to do is have a rows background color change to red if the first
databound column is 0 for the item. I have entered an onitemcreated sub
routine to handle the data item when its added to the grid but it hasn't
worked. This is my sub below:
Sub OnCreatedItem(ByVal sender As Object, ByVal e As
DataGridItemEventArgs)
If e.Item.Cells(0).Text = "0" Then
UnitLists.Items(e.Item.ID).BackColor =
System.Drawing.Color.ForestGreen
'e.Item.BackColor = System.Drawing.Color.ForestGreen
End If
End Sub
How do i code this so I can vary the background colors for the cells
depending on the data that it contains?
Thank you for your help,
Ryan
i'm trying to do is have a rows background color change to red if the first
databound column is 0 for the item. I have entered an onitemcreated sub
routine to handle the data item when its added to the grid but it hasn't
worked. This is my sub below:
Sub OnCreatedItem(ByVal sender As Object, ByVal e As
DataGridItemEventArgs)
If e.Item.Cells(0).Text = "0" Then
UnitLists.Items(e.Item.ID).BackColor =
System.Drawing.Color.ForestGreen
'e.Item.BackColor = System.Drawing.Color.ForestGreen
End If
End Sub
How do i code this so I can vary the background colors for the cells
depending on the data that it contains?
Thank you for your help,
Ryan