DisplayFormat, 0 non significatif?
Bonjour,
Je débarque sur un projet où il y a du MVC...
Dans un Model et pour faire un test :
Code:
1 2 3 4 5 6 7 8 9 10
| [Required(ErrorMessage = "Ce champ est obligatoire")]
[Display(Name = "Test")]
[DisplayFormat(DataFormatString = "{0:#.###}", ApplyFormatInEditMode = true)]
public Decimal DecimalNumber2
{
get
{
return new Decimal(40.123456);
}
} |
A la saisie, je peux saisir : 56.123, mais pas 56.12 (normal, l'on précise 3 chiffres après la virgule).
Dans le cahier des charges, il faudrait pourvoir saisir 56.12, le "système" complétant "automatiquement" par un 0 non significatif.
Mais... comment faire?? :?