Wednesday, August 12, 2009

I found the RowDataBound Event to work the best for me without a lot of additional overhead code. Basically the code makes sure the row is a data row, looks to see if column 3 (cells(2)) is equal to "1", if it is then make the entire row yellow and color cell 3 of the row crimson.

1 Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
2 If e.Row.RowType = DataControlRowType.DataRow Then
3 If e.Row.Cells(2).Text = "1" Then
4 e.Row.BackColor = System.Drawing.Color.Yellow
5 e.Row.Cells(2).BackColor = Drawing.Color.Crimson
6 End If
7 End If
8 End Sub

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

More Important Links

Followers