Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TestModel
- {
- [Display(Name = "Montant")]
- [DisplayFormat(DataFormatString = "{0:C2}")]
- public Decimal Amount
- {
- get;
- set;
- }
- [Display(Name = "Date d'achat")]
- [DataType(DataType.Date)]
- public DateTime Date
- {
- get;
- set;
- }
- }
- TestModel model = new TestModel
- {
- Amount = 1234.333M,
- Date = DateTime.Today.AddDays(-10)
- };
- @Html.DisplayFor(x => x.Amout) => "1 234,33 €"
- @Html.ValueFor(x => x.Amount) => "1234,333"
- @Html.DisplayFor(x => x.Date) => "23/03/2014"
- @Html.ValueFor(x => x.Date) => "23/03/2014 00:00:00"
- @Html.ValueFor(x => x.Amount) = Convert.ToString(x.Amount, CultureInfo.CurrentCulture)
- @Html.ValueFor(x => x.Amount, "0.00") = String.Format(x.Amount, "0.00", CultureInfo.CurrentCulture)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement