C#gridview颜色提示
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颜色提示的更多相关文章
- gridView删除提示框
实现方法: 双击GridView的OnRowDataBound事件: 在后台的GridView1_RowDataBound()方法添加代码,最后代码如下所示: protected void GridV ...
- GridView, ListView 区别
ListView, GridView部分的类层次结构 AbsListView的xml属性 android:listSelector 当前item高亮时,显示的drawable android:draw ...
- Bootstrap-全局样式的文本颜色和背景颜色
.text-五种颜色 文本颜色.text-info文本浅蓝颜色-提示.text-warning文本黄色-警告颜色.text-success文本绿色-成功颜色.text-primary文本深蓝色-警 ...
- 8个实用而有趣Bash命令提示行
很多人都对过命令行提示的重要性不屑一顾,甚至是一点都不关心.但是我却一点都不这么认为,一个好的命令行提示可以改变你使用命令的方式.为此,我在internet上找到一些非常实用,优秀,并有趣的bash的 ...
- secureCRT颜色方案设置
按照如下设置后vim编辑会有如下颜色提示
- bat显示多行文字,逐个显示哦!不同的颜色!
最近想修改bat文件输出提示的时候能有不同的颜色提示,在网上找了下,发现这个文章,实现的不错,先记录下来,留着后面研究. 这是曾经写的,又稍微改进了一下. @echo off set str=青天有月 ...
- IntelliJ IDEA WEB项目的部署配置
以下内容是我网上找的比较全面了,其中关于facets配置很多地方都没有说明,其实很重要,我加入了自己的理解.其他来自网络.在导入一个项目有问题时,建议先创建一个正确的web项目,然后对比配置项,一般就 ...
- PC网站CSS分享
这里想总结些编写网页的经验,以PC端的为主,前面总结过后台的,今天写些前台的,参考了bootstrap3.3.5.bootstrip2.3.2和模版matrix. 前段时间还写过一篇<前端基础学 ...
- git基本配置
用户信息 你个人的用户名称和电子邮件地址,用户名可随意修改,git 用于记录是谁提交了更新,以及更新人的联系方式. $ git config --global user.name "Donl ...
随机推荐
- 零基础学习C语言入门必备知识
今天跟大家一起从零学C语言: 1. C语言简介 1.1 C语言发展史 C语言是一种广泛使用的面向过程的计算机程序设计语言,既适合于系统程序设计,又适合于应用程序设计.C语言的发展历程大致如图1-1所示 ...
- 关于stm32串口必须要学的5个串口以及串口应用和注意事项
串口是我们常用的一个数据传输接口,STM32F103系列单片机共有5个串口. 其中1-3是通用同步/异步串行接口USART(Universal Synchronous/Asynchronous Rec ...
- 用C++实现的数独解题程序 SudokuSolver 2.6 的新功能及相关分析
SudokuSolver 2.6 的新功能及相关分析 SudokuSolver 2.6 的命令清单如下: H:\Read\num\Release>sudoku.exe Order please: ...
- 与 Python 之父聊天:更快的 Python!
Python猫注: 在今年 5 月的 Python 语言峰会上,Guido van Rossum 作了一场<Making CPython Faster>的分享(材料在此),宣告他加入了激动 ...
- Python ValueError: Attempted relative import in non-package Relative import相对引用 错误
包含相对路径import的python脚本不能直接运行,只能作为module被引用. 例如 from . import mod1 有这样代码的文件只能最为moulule为不能直接运行.相对路径就是相对 ...
- single-number leetcode C++
Given an array of integers, every element appears twice except for one. Find that single one. Note: ...
- Oracle 19c 单机
环境 vm虚拟机 双磁盘 操作系统 Oracle Linux 7.9 操作系统安装带图形 选择中文,注意不要新建用户 关闭防火墙 selinux 配置好IP 挂载系统盘镜像 修改主机名 配置hosts ...
- 安装、卸载 node.js出错 Could not access network location *:\node.js\ 出错
上周五,WIN10自动更新系统,导致我的node.js 和 Gradle 还有解压的winRAR都不能用!!!可恶 自动更新!!可恶啊!!! 然后我想把node.js重新卸载了再安装,结果 很慌很慌, ...
- AppScan 10安装使用
一.简介 AppScan是IBM的一款web安全扫描工具,具有利用爬虫技术进行网站安全渗透测试的能力,能够根据网站入口自动摸取网页链接进行安全扫描,提供了扫描.报告和修复建议等功能. appscan有 ...
- 后台管理系统:vue&node&MongoDB(一)
后台管理系统 使用工具: Vue Node Mongodb Element-ui 一.后台(Node+Mongodb) 前期准备: 需要下载的包: mongooes -------- ...