Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DefaultValue attribute
Message
De
27/05/2008 14:12:58
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01319742
Message ID:
01319744
Vues:
15
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform