Reputation: 45
how to change color / backcolor in gridview asp.net by databoud, i try like this i have found error. what there is solution with this problem. thanks
Private Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If (e.Row.Cells(1).Text) = "102" Then
e.Row.Cells(1).BackColor = System.Drawing.Color.Red
End If
End If
End Sub
Upvotes: 0
Views: 51
Reputation: 26
if (e.Row.Cells[0].Text == "12")
{
e.Row.Cells[0].ForeColor = System.Drawing.Color.Red;
}
else if(e.Row.Cells[0].Text == "13")
{
e.Row.Cells[0].ForeColor = System.Drawing.Color.Yellow;
}
Upvotes: 1