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 ...
随机推荐
- Spark面试题(二)
首发于我的个人博客:Spark面试题(二) 1.Spark有哪两种算子? Transformation(转化)算子和Action(执行)算子. 2.Spark有哪些聚合类的算子,我们应该尽量避免什么类 ...
- 《基于SD-SEIR模型的实验室人员不安全行为传播研究》
My Focus:基于SD-SEIR模型的实验室人员不安全行为的传播; 建模与实验仿真 Title: Study on Porpagation of Unsafe Bhavior of Laborat ...
- cf17B Hierarchy(额,,,水)
题意: Nick's company employed n people. Now Nick needs to build a tree hierarchy of «supervisor-surbod ...
- hdu 2199 Can you solve this equation?(二分法求多项式解)
题意 给Y值,找到多项式 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y 在0到100之间的解. 思路 从0到100,多项式是单调的,故用二分法求解. 代码 double c ...
- JAVA笔记11__File类/File类作业/字节输出流、输入流/字符输出流、输入流/文件复制/转换流
/** * File类:文件的创建.删除.重命名.得到路径.创建时间等,是唯一与文件本身有关的操作类 */ public class Main { public static void main(St ...
- openssh 8.2 升级 8.3
openssh 8.2 存在安全漏洞,升级为 openssh 8.3 需要安装的包:openssh-8.3p1.tar.gz.zlib-1.2.11.tar.gz.openssl-1.1.1g.tar ...
- CentOS7 导入oracle数据
1.切换到 oracle用户 #su - oracle 2.导入(一般的不会导入到sys账号下) #imp sys/密码@orcl file=/home/oracle/20200428.dmp fro ...
- FAIL : Keyword 'BuiltIn.Log' expected 1 to 6 arguments, got 12(解决方法)
RF运行关键字:Run Keyword If ,log输出报错"FAIL : Keyword 'BuiltIn.Log' expected 1 to 6 arguments, got 12. ...
- More Effective C++笔记(一)(精心整理)
一.基础议题 条款1:仔细区别pointers和references 指针使用*和->,引用使用"." 引用必须指向一个已初始化的对象,不能为null,而指针可以指向某个对象 ...
- 逐浪CMS+百度小程序开源包发布-对接海量资源助力推广
接入百度小程序海量流量就在使用Zoomla!逐浪CMS开发栈 这里有最强的CMS内核依托于国家高新企业Zoomla!逐浪之上 这里有最海量的用户流量依托于百度小程序 这里有最开放的技术栈 这里有最卓越 ...