OnRowCreated="gridStatistic_RowCreated

     private void FillUI()
{
gridStatistic.DataSource = dtStatistic;
gridStatistic.DataBind();
} protected void gridStatistic_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex > -1)
{
if (dtStatistic != null && dtStatistic.Rows.Count > 0)
{
decimal InfoReward = Convert.ToDecimal(dtStatistic.Rows[e.Row.RowIndex].ItemArray[dtStatistic.Columns.IndexOf("InfoReward")]);
decimal InfoMoney = Convert.ToDecimal(dtStatistic.Rows[e.Row.RowIndex].ItemArray[dtStatistic.Columns.IndexOf("InfoMoney")]);
if (InfoMoney > InfoReward)
{
e.Row.Cells[3].ForeColor = System.Drawing.Color.Red;
}
}
}
} ---------------或:---decimal数值对比--
protected void gridStatistic_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex > -1)
{
if (dtStatistic != null && dtStatistic.Rows.Count > 0)
{
decimal InfoReward = Convert.ToDecimal(dtStatistic.Rows[e.Row.RowIndex].ItemArray[dtStatistic.Columns.IndexOf("InfoReward")]);
decimal InfoMoney = Convert.ToDecimal(dtStatistic.Rows[e.Row.RowIndex].ItemArray[dtStatistic.Columns.IndexOf("InfoMoney")]);
decimal cs = InfoMoney - InfoReward;
if (cs>0)
{
e.Row.Cells[3].ForeColor = System.Drawing.Color.Red;
}
}
}
}
--------------
protected void gridStatistic_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex > -1)
{
if (dtStatistic != null && dtStatistic.Rows.Count > 0)
{
string InfoMoney="";
decimal InfoReward = Convert.ToDecimal(dtStatistic.Rows[e.Row.RowIndex].ItemArray[dtStatistic.Columns.IndexOf("InfoReward")]);
InfoMoney = Convert.ToString(dtStatistic.Rows[e.Row.RowIndex].ItemArray[dtStatistic.Columns.IndexOf("InfoMoney")]);
if (InfoMoney == "")
InfoMoney ="0"; if (Convert.ToDecimal(InfoMoney) > InfoReward)
{
e.Row.Cells[3].ForeColor = System.Drawing.Color.Red;
}
}
}
}

  

C#gridview颜色提示的更多相关文章

  1. gridView删除提示框

    实现方法: 双击GridView的OnRowDataBound事件: 在后台的GridView1_RowDataBound()方法添加代码,最后代码如下所示: protected void GridV ...

  2. GridView, ListView 区别

    ListView, GridView部分的类层次结构 AbsListView的xml属性 android:listSelector 当前item高亮时,显示的drawable android:draw ...

  3. Bootstrap-全局样式的文本颜色和背景颜色

    .text-五种颜色   文本颜色.text-info文本浅蓝颜色-提示.text-warning文本黄色-警告颜色.text-success文本绿色-成功颜色.text-primary文本深蓝色-警 ...

  4. 8个实用而有趣Bash命令提示行

    很多人都对过命令行提示的重要性不屑一顾,甚至是一点都不关心.但是我却一点都不这么认为,一个好的命令行提示可以改变你使用命令的方式.为此,我在internet上找到一些非常实用,优秀,并有趣的bash的 ...

  5. secureCRT颜色方案设置

    按照如下设置后vim编辑会有如下颜色提示

  6. bat显示多行文字,逐个显示哦!不同的颜色!

    最近想修改bat文件输出提示的时候能有不同的颜色提示,在网上找了下,发现这个文章,实现的不错,先记录下来,留着后面研究. 这是曾经写的,又稍微改进了一下. @echo off set str=青天有月 ...

  7. IntelliJ IDEA WEB项目的部署配置

    以下内容是我网上找的比较全面了,其中关于facets配置很多地方都没有说明,其实很重要,我加入了自己的理解.其他来自网络.在导入一个项目有问题时,建议先创建一个正确的web项目,然后对比配置项,一般就 ...

  8. PC网站CSS分享

    这里想总结些编写网页的经验,以PC端的为主,前面总结过后台的,今天写些前台的,参考了bootstrap3.3.5.bootstrip2.3.2和模版matrix. 前段时间还写过一篇<前端基础学 ...

  9. git基本配置

    用户信息 你个人的用户名称和电子邮件地址,用户名可随意修改,git 用于记录是谁提交了更新,以及更新人的联系方式. $ git config --global user.name "Donl ...

随机推荐

  1. TensorFlow从入门到入坑(1)

    初识TensorFlow 一.术语潜知 深度学习:深度学习(deep learning)是机器学习的分支,是一种试图使用包含复杂结构或由多重非线性变换构成的多个处理层对数据进行高层抽象的算法. 深度学 ...

  2. set prompt = "任意匹配字符" 当前目录详解

    转载:https://blog.csdn.net/alexdream/article/details/6865730 研究了两天的FreeBSD,总是感觉输入提示符那里怪怪的,而且默认的提示符还不带显 ...

  3. docker的集群管理工具

    docker 集群管理三剑客: docker compose: Compose 是用于定义和运行多容器 Docker 应用程序的工具.通过 Compose,您可以使用 YML 文件来配置应用程序需要的 ...

  4. 【代码更新】单细胞分析实录(21): 非负矩阵分解(NMF)的R代码实现,只需两步,啥图都有

    1. 起因 之前的代码(单细胞分析实录(17): 非负矩阵分解(NMF)代码演示)没有涉及到python语法,只有4个python命令行,就跟Linux下面的ls grep一样的.然鹅,有几个小伙伴不 ...

  5. js点击事件 登录

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  6. linux下安装Git并生成SSH key

    系统:contens7.4 1.下载源码解压 wget https://github.com/git/git/archive/v2.3.0.zip unzip v2.3.0.zip cd git-2. ...

  7. SqlServer修改某个字段的默认值时的操作步骤

    sqlserver有时候需要修改一个字段的默认值,却发现修改(update)不了,也删除(delete)不了,排查发现,需要先删除原有的默认值约束,才行:步骤如下1.2.3.若原来这个字段就没有默认值 ...

  8. Springboot 启动分析

    启动类 Spring 启动类主要是 Annotation (@SpringBootApplication) 和 main 方法体中的 SpringApplication.run. 其中注解 @Spri ...

  9. rabbitMQ报错:Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; protocol method:

    1.输入的机器的 IP:15672进入Raabitmq的登陆管理界面 点击admin,进去点击set permission ok, 在运行应该就不会包这个错了

  10. js中修改this指向的方法(call,apply,bind)

    前言:call.apply和bind都是为了改变某个函数运行时的this指向的,对于前端人员来说,关于this的掌握程度,直接决定了前端水平的高低.下面我们就来简单浅显易懂的来看一下es5中常用的三种 ...