In the model class, I am trying to display a currency format for the "Price" field, however the code I am using is not producing the desired result, and I have no idea why it is not working. I do not want to hard code the $ on every page, that would be a hassle. Here is the code I have in the model.
public partial class Item
{
public int ItemId { get; set; }
public string ItemDescription { get; set; }
public Nullable<int> Quantity { get; set; }
[DisplayName("Price Each")]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:c}")]
public string Price { get; set; }
[DisplayName("Due Date")]
[DisplayFormat(DataFormatString ="{0:d}", ApplyFormatInEditMode = true)]
public Nullable<System.DateTime> DueDate { get; set; }
[DisplayName("Date Received")]
[DisplayFormat(DataFormatString= "{0:d}", ApplyFormatInEditMode = true)]
public Nullable<System.DateTime> DateReceived { get; set; }
public string Comments { get; set; }
[DisplayName("W/O# or Cost Center")]
public int PurchaseID { get; set; }
public virtual PurchaseOrder PurchaseOrder { get; set; }
}
Thanks.