gridview某行颜色根据数值而变化

  在gridview的RowDataBound()事件中:

If e.Row.RowType=DataControlRowType.DataRow Then

   Dim unitsInstock As Integer=Convert.ToInt32(DataBinder.Eval(e.Row.DataItem,”UnitsInStock”))

   if unitsInstock=0 then

       e.Row.BackColor=Drawing.Color.Yellow

   end if

end if

 

Eval():

取得数据容器中某列的值

posted @ 2009-06-04 21:32  斑点海豚---寂静的港湾  阅读(181)  评论(0编辑  收藏  举报