Red Font for Dates 21 > than today

I'm using ASP.net and have a gridview with a date column. I'm trying to highlight in redfont all the dates that are 21 days greater than Todays current date. I have a css .redfont with bold font-weight. I'd like to do this as an itemtemplate. What the way to do this via EVAL.
Southern_GentlemanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kyle AbrahamsSenior .Net DeveloperCommented:
on the item template you should be able to set the class

class = '<%# ((TimeSpan) DateTime.Now - DateTime.Parse(Eval("StartDate").ToString())).Days > 21 ? "redClass" : "NormalClass" %>'
0
Southern_GentlemanAuthor Commented:
Thanks Kyle, keep coming with an error.

BC30108: 'TimeSpan' is a type and cannot be used as an expression.
0
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Somebody asked a very similar question earlier today.  Here is my solution using momentjs  http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28474242.html#a40191345

This was for 30 days but you can see where you can adjust as needed.   This is a front end / client side solution.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Kyle AbrahamsSenior .Net DeveloperCommented:
Try DateTime.TimeSpan instead of just the timespan.
0
Southern_GentlemanAuthor Commented:
Thanks Scott, got it to work like a champ.
0
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Awesome!    Did you use momentjs?
0
Southern_GentlemanAuthor Commented:
Yes, I then added it to the cell style of my gridview.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.