Date Time Transformation Showing items 30 days old

Chart Industries asked on October 14, 2014 16:22

I'd like to write a transformation that would retrieve items added 30 days or less ago and display them as 'new' and other items would just display normally. can anyone give me some tips on how you could do that?


Recent Answers

Joshua Adams answered on October 14, 2014 22:12

In the external databound event just set up your switch statement and compare your stored date to the current date. Or compare it to the currentdate and add(-30 days) so and if yours is greater, then it passes. Kentico has examples of this everywhere, and you mimic their onexternaldatabound events in their unigrids.

Once your comparison is made, then you can change the color of the row by possibly using the gridviewrow style attribute and use a css class to set the background.


0 votesVote for this answer Mark as a Correct answer

Rock Bolton answered on October 16, 2014 20:03

I think the user is trying to achieve something like this (insidea an ASCX Tranformation)...

<% if (Convert.ToDateTime(Eval("ArrivalDate")) > DateTime.Now.AddDays(-30)) { %> <% } %>

...but I think Eval returns an object, as opposed to a string, not sure.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.