David Pickart
asked on
Change color of row based on bound YES/No column.
I have a YES/NO Field bound to a column in a gridview. If that column is false, I would like to change color of row, otherwise leave as is.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I also added a line ".Cells(0).Visible = False" that hides first column, which has the edit and delete tags. But when I do this the header text for the column is still there. How can I hide that as well? Here is my code.
With e.Row
Dim rv As Data.DataRow
If .RowType = DataControlRowType.DataRow
rv = CType(.DataItem, Data.DataRowView).Row
' Change color
If Not IsDBNull(rv("Approved")) Then
If rv("Approved") = "True" Then
.BackColor = Drawing.Color.Red
.Cells(0).Visible = False
Else
End If
End If
End If
End With