根据c#中的字段值更改gridview中的行颜色 [英] Change row color in gridview based on a field value in c#

查看:586
本文介绍了根据c#中的字段值更改gridview中的行颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

符号有些问时间

usd 1.94545 1.9456 4/3/2014 11:54:11 AM

euro 1.45666 1.4555 4/3/2014 11:54:11 AM



这是c#网格视图格式。当某些(列)值增加时,gridview行是每秒变化我希望行颜色是绿色去除时间我想要行颜色红色的一些(列)值。没有sql db ..

Symbol some ask time
usd 1.94545 1.9456 4/3/2014 11:54:11 AM
euro 1.45666 1.4555 4/3/2014 11:54:11 AM

this is the c# grid view format. the gridview row is every second changable when "some" (column) value increase i want row color is green degrease the some (column) value that the time i want row color red color. without sql db..

推荐答案

我相信你要求的是ASP.NET Grid View。值是否会自动更新?如果是,您可以尝试通过在网格视图中使用条件绑定来实现此目的。



ASP.NET GridView提供了使用条件绑定表达式的灵活性,我们可以在绑定表达式中使用某些条件。取决于表达式的评估值,ASP.NET GridView将在页面上呈现内容。



使用ASP.NET GridView进行条件绑定表达式 [ ^ ]



在您的情况下,您可以使用字段检查值并为您的颜色应用一些颜色网格根据需要。



希望这对你有帮助。
I believe you are asking for ASP.NET Grid View . Are the values getting updated automatically ? If yes, You can try to achieve this by using conditional Binding in grid View.

ASP.NET GridView provides the flexibility to use conditional binding expression where we can use some condition with bind expression. Depends on the evaluation value of the expression, ASP.NET GridView will render the content on page.

Conditional Binding Expression with ASP.NET GridView [^]

In your case, you can check the value with the field and apply some color to your grid as needed.

Hope this will help you.


这篇关于根据c#中的字段值更改gridview中的行颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆