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;
}
}
}
}

  

最新文章

  1. C# 获取磁盘剩余空间
  2. iptables rule
  3. jQuery UI dialog
  4. dubbo服务框架学习
  5. 【Android】以BaseAdapter做适配器的ListView及其性能优化
  6. MUH and Cube Walls
  7. sr4000自带API和opencv结合获取图像
  8. Lazy Load Plugin for jQuery延迟加载测试成功
  9. Mysql基本类型(五种年日期时间类型)——mysql之二
  10. Central Europe Regional Contest 2012 Problem H: Darts
  11. 古老server源代码迁移到新server
  12. struts升级到最高版本后遇到的问题。关于actionmessage传递问题。
  13. mui开发app之自定义事件以更新其他页内容
  14. memset库函数
  15. vagrant极简教程:快速搭建centos7
  16. 递归遍历所有xml的节点及子节点
  17. Spark1.0.0 源码编译和部署包生成
  18. .NET MVC中的数据验证
  19. kubespray 一键安装k8s集群
  20. nginx.conf中关于nginx-rtmp-module配置指令详解

热门文章

  1. ESD
  2. Git新建本地分支
  3. 2021 ICPC Gran Premio de Mexico 2da Fecha部分题题解
  4. JAVA笔记14__多线程共享数据(同步)/ 线程死锁 / 生产者与消费者应用案例 / 线程池
  5. pycharm基本使用python的注释语法
  6. html5的Message信息提示框
  7. flyway的使用
  8. MySQL中特别实用的几种SQL语句送给大家
  9. SpringCloud升级之路2020.0.x版-30. FeignClient 实现重试
  10. 通过实现仿照FeignClient框架原理的示例来看清FeignClient的本质