您的位置:首页 > 编程语言 > ASP

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

2010-04-28 13:30 531 查看
//改变当前处理列的颜色
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;
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: