0

I have a Controller returns a decimal value eg: 1.00 I need to show it as

1,00 in the view according to the culture

 $.ajax({
        type: 'POST',
        url: '@Url.Action("ValidateCouponCode","MyAccount")',
        dataType: 'json',
        data: '{ "couponCode" :"' + couponCode + '", "lockerCost" : "' + lockerCost + '" }',
        contentType: 'application/json',
        success: function (data) {
            $.unblockUI();
            $("#txtCouponValue").val(data.CouponAmount);
            $("#txtPaymentAmount").val(data.PaymentAmount);
        },
        error: function () {
            alert("Error occurred");
        }
    });
}
ekad
  • 14,436
  • 26
  • 44
  • 46
Justin CI
  • 2,693
  • 1
  • 16
  • 34
  • There are lots of [plugins](http://jquery-plugins.net/tag/input-format) that will help you do this. – James May 08 '15 at 09:31
  • According to which 'culture' (the servers, the browsers)? And what does the code you have shown have to do with displaying a value in the view? –  May 08 '15 at 10:22
  • Iam using spanish culture es-AR – Justin CI May 08 '15 at 11:26
  • What's the point of tagging the question with c# and showing jquery code instead? In c# you can use culture specific decimal formatting. Not sure what about javascript. – Zohar Peled May 08 '15 at 12:05
  • Check this link ....It will help you.......... http://stackoverflow.com/questions/12067375/html-displayfor-decimal-format – Kamran Khan Jun 02 '15 at 06:42

1 Answers1

0

You can either use int.ToString("#.0", Thread.CurrentThread.CurrentUICulture) in server or you can use Number.prototype.toLocaleString() if you want it in client side if you're using client's local culture.