aspxgridview改变行列的颜色

在两个事件中处理:

  1. //改变处理列
  2. protected void ASPxGridView1_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)  
  3.     {  
  4.         if (e.DataColumn.FieldName == "LEFTMONEY")  
  5.         {  
  6.             if (float.Parse(e.CellValue.ToString()) < 0)  
  7.             {  
  8.                 e.Cell.ForeColor = System.Drawing.Color.Red;  
  9.             }  
  10.         }  
  11.     }  
  12.   
  13. //改变当前处理行的颜色  
  14.     protected void ASPxGridView1_HtmlRowPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableRowEventArgs e)  
  15.     {  
  16.         if (e.RowType != DevExpress.Web.ASPxGridView.GridViewRowType.Data) return;  
  17.         string ispick = e.GetValue("IsPromotion").ToString();  
  18.         if (ispick == "1")  
  19.         {  
  20.             e.Row.ForeColor = System.Drawing.Color.Red;  
  21.         }  
  22.   
  23.     }  

猜你喜欢

转载自blog.csdn.net/harhawk/article/details/81013738