I have a team working together 30 days and I have a textbox insert into date if you insert 01/01/2016(TextBox1) automatically display in autoPostBack 10/02/2016 (TextBox2)
I want if the team working together from 1-27 days the color of label change into green and from 28-29 days change color into yellow and more than 30 days the label color change into red.


Milan Prajapati107 reputationPosted Oct 18, 2016, 5:06 AM EDT
Abdalla ElawadRank #1,443 · 1.1K reputationPosted Oct 18, 2016, 5:12 AM EDT
Amit GuptaRank #190 · 12.8K reputationPosted Oct 18, 2016, 11:33 AM EDT
Subtract the 2 dates and get total no of days
Timespan ts = Date2.Subtract (date1);
Int totalDays =ts.TotalDays;
if (totalDays <=27)
Label.ForeColor = Colors.Green;
else if (totalDays>=28 && totalDays <=29)
Label.ForeColor = Colors.Yellow;
else
Label.ForeColor = Colors.Red;