Tips and tricks for .NET using ASP and VB code.

When a Cell in a Certain Column of a GridView Has a Certain Value, Change the Colors of That Row

Protected Sub GridView1_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowCreated
If e.Row.RowType = DataControlRowType.DataRow Then
If UCase(Trim(DataBinder.Eval(e.Row.DataItem, "FieldName"))) = "SOME VALUE" Then
e.Row.ForeColor = Drawing.Color.Yellow
e.Row.BackColor = Drawing.Color.Red
End If
End If
End Sub

No comments:

Post a Comment

Search This Blog