I have a textbox, which receives a data by AJAX.
@Html.TextBox("CantidadPago", string.Format("{0:C}",0), new{@class = "form-control"})
AJAX
$.ajax({
type: 'POST',
url: '@Url.Action("CalcularCantidadPago")',
datatype: 'json',
data: {totalC: $("#Total").val()},
success: function (Precios) {
$("#CantidadPago").val(Precios[0]); },
});
And then I get it like that
and what I want is to format it. Something like this:
I tried with string.Format("{0:C}",0)
, but when I assign the value brought to the textbox it deletes the format.
How can I make it so that when I receive the data I keep the format and sending it does not affect my operation?