How can i show cart-total as decimal

Dec 22, 2011 at 1:45 PM

 

I'm using AJAX update while removing cart items from cart.

    $(function () {
        // Document.ready -> link up remove event handler
        $(".RemoveLink").click(function () {
            // Get the id from the link
            var recordToDelete = $(this).attr("data-id");
            if (recordToDelete != '') {
                // Perform the ajax post
                $.post("/ShoppingCart/RemoveFromCart", { "id":
recordToDelete
                },
                    function (data) {
                        // Successful requests get here
                        // Update the page elements

                        if (data.CartTotal == 0) {
                            document.location.href = "/ShoppingCart";
                        } else {



                            if (data.ItemCount == 0) {
                                $('#row-' + data.DeleteId).fadeOut('slow');
                            } else {
                                $('#item-count-' +
data.DeleteId).text(data.ItemCount);
                            }


                            $('#item-price').text(data.SalePrice)
                            $('#cart-total').text(data.CartTotal);
                            $('#update-message').text(data.Message);
                            $('#cart-status').text('Cart (' + data.CartCount + ')');
                        }
                    });

            }
        });

    });


And code at Razor is below.

<div class="grid_2 alpha totalprice" id="cart-total">
@String.Format("{0:C}", @Model.CartTotal)
</div>

But it renders cart-total as number instead of decimal, after removing from cart.

I need to show cart total as >>> 12,00 USD
But it updates cart-total as >> 12

At my controller, CartTotal is defined as decimal

 

 


Thank you in advance.