CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 Change Date Font color when date has passed

Print topic Send  topic

Author Message
ajax

Posts: 5
Posted: 10/20/2008, 6:35 PM

I have a Date label named Due Date; I need the font color to change to red if the due date has passed, can someone point me in the right direction. I did find the code to change Text color but not for a Date range.
View profile  Send private message
Nicole

Posts: 586
Posted: 10/22/2008, 12:59 AM

Ajax,
I think I can help you. You can use a code like this in the Before Show event of Label control. The solution is applicable for labels which Data Type is set to Date.
  
DateTime d = DateTime.Parse(FormNameLabelName.Text);  
            if (d < DateTime.Now) FormNameLabelName.Text = "<font color=\"red\">" + FormNameLabelName.Text + "</font>";  
Remember to set Content property of the Label to HTML.

_________________
Regards,
Nicole
View profile  Send private message
ajax

Posts: 5
Posted: 10/22/2008, 8:16 AM

Thanks Nicole, worked perfictly once I convert it from C# to VB.Net.

Dim d As DateTime = DateTime.Parse(CompanyStages_Results_StaDueDate.Text)
If d < DateTime.Now Then
CompanyStages_Results_StaDueDate.Text = "<font color=""red"">" + CompanyStages_Results_StaDueDate.Text + "</font>"
End If
Thanks again
View profile  Send private message
ajax

Posts: 5
Posted: 10/22/2008, 8:16 AM

sorry posted 2x
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.