1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16:
public void GridView2_DataBound(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DateTime currentRowDate = DateTime.Now; // your default value DateTime.TryParse(e.Row.Cells[0].Text, out currentRowDate); if (currentRowDate > DateTime.Now.AddMonths(-3)) { e.Row.Cells[0].Style["background-color"] = "red"; } else if (currentRowDate > DateTime.Now.AddMonths(-6)) { e.Row.Cells[0].Style["background-color"] = "yellow"; } } }