我需要更改我的网格视图单元格的背景颜色,但是它没有起作用。
Protected Sub OnRowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GridView2.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
For Each er As GridViewRow In GridView2.Rows
If er.Cells(4).Text = "Formation" Then
er.Cells(4).BackColor = Color.Red
End If
Next
End If
End Sub
如何根据单元格值更改背景颜色?