protected void GridViewMessage_RowDataBound( object sender, GridViewRowEventArgs e) ... { foreach(TableCell tc in e.Row.Cells) ...{ tc.Attributes["style"] = "border-color:DimGray"; //设定边框的颜色 } if( e.Row.RowType == DataControlRowType.DataRow) ...{ string lbl = DataBinder.Eval(e.Row.DataItem, "IfRead").ToString(); if(lbl =="还未阅读") ...{ //e.Row.BackColor = Color.Red ; //行颜色 e.Row.Cells[5].ForeColor = Color.Red; } } }