I have to pages that need to show the item amount with currency format. The first one is where currency is entered and the second one where currency is displayed.
I would like the EditorFor to show an R indicated Rands and then i would like the value to be decimal.
Here is my EditorFor:
<div class="editor-field">
@Html.EditorFor(model => model.TransactionModel.Price)
</div>
I have tried many different ways and can't get any to work.
With this example below it does not know what 'CurrencyPrice' is in the second line.
var CurrencyPrice = '@Model.TransactionModel.Price';
document.getElementById('TransactionModel.Price').value = '@string.Format("{0:C}", CurrencyPrice)';
I have also tried these in my transactionModel:
//[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:c}")]
//[UIHint("Currency")]
//[DisplayFormat(DataFormatString = "{0:F2}", ApplyFormatInEditMode = true)]
//[DataType(DataType.Currency)]
public decimal Price { get; set; }
Could someone please tell me how i can get this right?
Right now i will accept any working method.