ASPXGridView控件通过列值来改变行的颜色或列的颜色

//改变当前处理列的颜色 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; } }

你可能感兴趣的:(String,object)