protected void
GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if
(e.Row.RowType == DataControlRowType.DataRow)
{
//
determine the value of the status field
int
status = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "status"));
// color
the background of the row
switch
(status)
{
case
0:
e.Row.BackColor = Color.LightGreen;
break;
case
1:
e.Row.BackColor = Color.Red;
break;
case
2:
e.Row.BackColor = Color.Blue ;
break;
}
}
}
沒有留言:
張貼留言