在WebForm中
在DataGridView的RowDataBound事件里判断并修改:
if(e.Row.Cells[n].Text=="0")
{
e.Row.Attributes.Add("bgColor", "red");
}
else if(e.Row.Cells[n].Text>"500")
{
e.Row.Attributes.Add("bgColor", "green");
}
//这里的n不是你的列的下标值
在WinForm中
private void dataGridVie