In my web app in Global.asax I just add this code to the Application Start event handler:
SmartDate.SetDefaultFormatString(
"MM/dd/yyyy")This changed the default output of all SmartDates to use leading zeros on dates.
This adds a lot of consistency to my screens and reports. I standardized the output on dozens of reports with this one line of code.
Rocky - just wanted to say thanks for adding it to the framework.
It was a little thing but it just came in very handy.
Joe
Hey Joe or Rocky,
Can the same be done in the App.config or some other startup file for Windows CSLA Apps?
Kelly.
You could certainly do so, yes. CSLA doesn’t do it for
you, but it is just Joe’s line of code, but with the format string
retrieved using System.Configuration.ConfigurationManager – not hard.
Rocky
From: jkellywilkerson
[mailto:cslanet@lhotka.net]
Sent: Friday, February 16, 2007 11:55 AM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] SmartDate Default Format
Hey Joe or Rocky,
Can the same be done in the App.config or some other startup file for
Windows CSLA Apps?
Kelly.
in each SmartDate Property Get method. But, if I could set it globally at runtime similar to the way Joe did using Global.asax, that would be much nicer.
Thanks,
Kelly.
Copyright (c) Marimer LLC