数据的color devex xtragrid行大于一个值

时间:2011-09-20 15:20:27

标签: c# colors devexpress xtragrid

当我尝试为约束值着色行时,它会因为字符串值而产生:

private void gvTerbiyedekiDispolar_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
    {
        GridView View = sender as GridView;
        if (e.RowHandle >= 0)
        {
            string category = View.GetRowCellDisplayText(e.RowHandle, View.Columns["fire"]);
            if (category == "0,10")
            {
                e.Appearance.BackColor = Color.LightGoldenrodYellow;                   
            }               
        }
    }

但如果我尝试“为大于0.1的值着色”,它会给我一个运行时错误,如此代码

 private void gvTerbiyedekiDispolar_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
    {
        GridView View = sender as GridView;
        if (e.RowHandle >= 0)
        {
            double category = Convert.ToDouble(View.GetRowCellDisplayText(e.RowHandle, View.Columns["fire"]));
            if (category > 0.10)
            {
                e.Appearance.BackColor = Color.LightGoldenrodYellow;                   
            }               
        }
    }

我该怎么办?

1 个答案:

答案 0 :(得分:0)

我用ISNULL将NULL值替换为0并且没有问题。