Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DefaultValue attribute
Message
From
27/05/2008 14:12:58
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01319742
Message ID:
01319744
Views:
14
This message has been marked as the solution to the initial question of the thread.
How did you code that? You probably need to use typeof(DateTime) and a string value:
[DefaultValue(typeof(DateTime), "5/27/08")]
I'm not sure (because I haven't actually tried it), but you *might* be able to get away with this:
[DefaultValue(typeof(DateTime), DateTime.Today.ToString())]
~~Bonnie




>Hi everybody,
>
>In the UserControl I'd like to set a DefaultValue for the custom date property. I tried DefaultValue(DateTime.Today), but it returns an error in compile time. What should I set as a default value (how can I create some fixed datetime value)?
>
>Thanks in advance.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform