博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

GridView的RowdataBound事件

Posted on 2007-11-15 14:05  豆丁不想长大  阅读(1634)  评论(2)    收藏  举报
public void productsGridView_RowDataBound(object sender,
GridViewRowEventArgs e)
{
 if (e.Row.RowType == DataControlRowType.DataRow)
 {
  int unitsInStock = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "UnitsInStock"));
  if (unitsInStock == 0)
   e.Row.BackColor = Color.Yellow;
 }
}