Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
If e.Item.ItemIndex > -1 Then
Dim row As DataRowView = e.Item.DataItem
If row("field1") = "abc" Then '这里代表:如果当前行某个字段等于某个值
e.Item.BackColor = Color.LightYellow '设置当前行背景色
e.Item.ForeColor = Color.Red '设置当前行前景色
End If
End If
End Sub