If you are using Asp.Net WebForms application, here is how you do it.
Create a gridview with OnRowDataBound event handler like below:
<asp:GridView ID="gvChangeColor" runat="server" OnRowDataBound="gvChangeColor_RowDataBound">
And here is a sample code to change the background color of row based on some condition. You have to modify the code to suit your needs.
Protected Sub gvChangeColor_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.Cells(0).Text.StartsWith("3") Then
e.Row.BackColor = Color.Green
If you are using WinForms, then please refer this GridView's RowDataBound equivalent event in Windows DataGridView
Here is how you do it in WinForms:
Private Sub dataGridView1_CellFormatting(sender As Object, e As DataGridViewCellFormattingEventArgs)
If e.Value.ToString().StartsWith("3") Then
dataGridView1.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.Green