Hello,
I cannot figure this out for the life of me and it can't possibly be this difficult. I have a datagrid and I'm trying to set the backcolor of a specific cell based on the text of that cell (not that uncommon I presume). My code:
The crazy thing is, if I change the
to
it prints just fine so it's obviously getting inside there but the cell isn't changing to red. It maintains its boring white backcolor. Any help is greatly appreciated.
I cannot figure this out for the life of me and it can't possibly be this difficult. I have a datagrid and I'm trying to set the backcolor of a specific cell based on the text of that cell (not that uncommon I presume). My code:
Code:
Sub ItemDataBound(ByVal Sender As Object, ByVal E As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dtgResults.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
If e.Item.Cells(7).Text = "no" Then
e.Item.Cells(7).BackColor = System.Drawing.Color.Red
End If
End If
End Sub
The crazy thing is, if I change the
Code:
e.Item.Cells(7).BackColor = System.Drawing.Color.Red
Code:
e.Item.Cells(7).Text = "wtf???"