在两个事件中处理:
- //改变处理列
- protected void ASPxGridView1_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
- {
- if (e.DataColumn.FieldName == "LEFTMONEY")
- {
- if (float.Parse(e.CellValue.ToString()) < 0)
- {
- e.Cell.ForeColor = System.Drawing.Color.Red;
- }
- }
- }
- //改变当前处理行的颜色
- protected void ASPxGridView1_HtmlRowPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableRowEventArgs e)
- {
- if (e.RowType != DevExpress.Web.ASPxGridView.GridViewRowType.Data) return;
- string ispick = e.GetValue("IsPromotion").ToString();
- if (ispick == "1")
- {
- e.Row.ForeColor = System.Drawing.Color.Red;
- }
- }