TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
rulec444
NA
81
0
datagrid cell color change based on datetime
Sep 28 2004 12:28 PM
I have a bound datagrid on an asp.net page. One column is filled with a DateDue, datetime. I am trying to check and if the date is less than a week out, I need to make the cell or text Red. This is what I've attempted and, of course, it doesn't work: private void dgProjects_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView drv = (DataRowView)e.Item.DataItem; if(drv.Row.ItemArray[6] <= DateTime.Now )//and somehow add 7 days to this date) { e.Item.Cells[3].BackColor = Color.Red; } } } Thanks - I appreciate any help!!
Reply
Answers (
6
)
ASP.NET using both VB and C#.
Export DataGrid to Excel