更改单元格颜色不同的价值观 - 的GridView [英] Change cell color on different values - Gridview

查看:109
本文介绍了更改单元格颜色不同的价值观 - 的GridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要区分两个连续的单元格。

I need to distinguish two consecutive cells.

每个人一排,如果他们有不同的价值观,当databindind值到GridView。

Each one in a row, if they have different values, when databindind the values to a gridview.

因此​​,如果第1行中我有细胞ABC和行2中我有细胞CBA

So, if in the row 1 I have the cell "ABC" and in the row 2 I have the cell "CBA".

我要颜色每个单元以不同的颜色。

I need to color each cell with a different color.

什么是做到这一点的最好方法是什么?

What is the best way to do it?

推荐答案

您可以做到这一点的GridView控件的RowDataBound事件。保持previous行视图状态或会话,并与下一行相匹配。如果简化版,匹配,改变颜色,否则不会改变。

you can do it on the rowdatabound event of the gridview. Keep the previous row in viewstate or session and match it with the next row. If it does't match, change the color otherwise don't change.

这篇关于更改单元格颜色不同的价值观 - 的GridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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