如果日期小于GRIDVIEW中的今天日期,则更改单元格的颜色 [英] change back color of cell if the date is less than todays date in GRIDVIEW

查看:90
本文介绍了如果日期小于GRIDVIEW中的今天日期,则更改单元格的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨frndss !!



在我的网页上我有Gridview,我在起诉asp.net c#。



现在我想更改单元格的背面颜色,如果日期小于今天的日期。



我的列名为ExpiryDate ...假设如果在gridview单元格中,则日期小于今天的日期。然后单元格背面颜色必须变为红色。



这个单元格是gridview中的单元格[6]。



在数据库表中我把ExpiryDate列数据类型作为日期时间



请帮帮我,怎么做。



谢谢。

hi frndss !!

on my webpage i have Gridview, am suing asp.net c#.

now i want to change the back color of my cell, if the date is less than todays date.

I have column name as ExpiryDate...Suppose if in gridview cell, the date is less than todays date. then the cell back color must change to RED.

This cell is cell[6] in gridview.

In Database table i took ExpiryDate column Datatype as Datetime

Please help me, how to do this.

Thanks.

推荐答案

亲爱的朋友,



在此处发布问题之前,请先搜索谷歌。



关于如何在gridview中更改单元格背景颜色约126,000



在以下链接中,解决方案2是您的问题的答案: -



更改GRIDVI的单元格颜色EW基于系统日期(解决方案2)



请不要忘记将此标记为您的答案,如果它可以帮助您。


问候



Varun Sareen
Dear Friend,

Always search google first before posting your question here.

About 126,000 on how to change cell background color in gridview

In the below link, Solution 2 is the answer to your question:-

change cell color of GRIDVIEW based on system date (Solution 2)

Please don''t forget to mark this as your answer if it helps you out.

Regards

Varun Sareen


亲爱的朋友,



在此处发布问题之前,请先搜索谷歌。



关于如何在gridview中更改单元格背景颜色约126,000



在以下链接中,解决方案2是您的问题的答案: -



更改GRIDVI的单元格颜色EW基于系统日期(解决方案2)



请不要忘记将此标记为您的答案,如果它可以帮助您。


问候



Varun Sareen
Dear Friend,

Always search google first before posting your question here.

About 126,000 on how to change cell background color in gridview

In the below link, Solution 2 is the answer to your question:-

change cell color of GRIDVIEW based on system date (Solution 2)

Please don''t forget to mark this as your answer if it helps you out.

Regards

Varun Sareen


DateTime _dt1 = Convert.ToDateTime(GridView1.Rows[0][6]);
DateTime _dt2 = Convert.ToDateTime(DateTime.Now.ToString("MM/dd/yyyy"));
if (_dt1 < _dt2)
{
    GridView1.Rows[0][6].BackColor = System.Drawing.Color.Red;
}


这篇关于如果日期小于GRIDVIEW中的今天日期,则更改单元格的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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