Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DefaultValue attribute
Message
 
 
To
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:
01319746
Views:
13
>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
>

The second version didn't work, but the first did. I was trying DefaultValue(DateTime.Today) and also was trying to use Convert class, but didn't think of adding typeof at the beginning.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform