C#gridview颜色提示
2024-09-04 10:37:47
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# 获取磁盘剩余空间
- iptables rule
- jQuery UI dialog
- dubbo服务框架学习
- 【Android】以BaseAdapter做适配器的ListView及其性能优化
- MUH and Cube Walls
- sr4000自带API和opencv结合获取图像
- Lazy Load Plugin for jQuery延迟加载测试成功
- Mysql基本类型(五种年日期时间类型)——mysql之二
- Central Europe Regional Contest 2012 Problem H: Darts
- 古老server源代码迁移到新server
- struts升级到最高版本后遇到的问题。关于actionmessage传递问题。
- mui开发app之自定义事件以更新其他页内容
- memset库函数
- vagrant极简教程:快速搭建centos7
- 递归遍历所有xml的节点及子节点
- Spark1.0.0 源码编译和部署包生成
- .NET MVC中的数据验证
- kubespray 一键安装k8s集群
- nginx.conf中关于nginx-rtmp-module配置指令详解
热门文章
- ESD
- Git新建本地分支
- 2021 ICPC Gran Premio de Mexico 2da Fecha部分题题解
- JAVA笔记14__多线程共享数据(同步)/ 线程死锁 / 生产者与消费者应用案例 / 线程池
- pycharm基本使用python的注释语法
- html5的Message信息提示框
- flyway的使用
- MySQL中特别实用的几种SQL语句送给大家
- SpringCloud升级之路2020.0.x版-30. FeignClient 实现重试
- 通过实现仿照FeignClient框架原理的示例来看清FeignClient的本质