We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Currency format

Thread ID:

Created:

Updated:

Platform:

Replies:

118101 Jan 31,2015 02:05 PM Feb 3,2015 01:32 AM ASP.NET MVC 3
loading
Tags: Grid
Martin Ross
Asked On January 31, 2015 02:05 PM

I'm trying to display currency data in a column in the grid in British Pounds Sterling.  I've tried setting the grid's Locale using the Gridbuilder method (to en-GB) - this appears to have no effect.  I've tried calling Globalize.culture - also no effect.  I've tried a format string of {0:£###,##0.00} which causes a javascript error.  Anyone else managed this?

Ajith R [Syncfusion]
Replied On February 2, 2015 07:29 AM

 

Hi Martin,

Thanks for using Syncfusion products.

Query 1: I've tried setting the grid's Locale using the Gridbuilder method (to en-GB) - this appears to have no effect.  I've tried calling Globalize.culture - also no effect

We suggest you to refer the globalize.culture.en-GB.min.js file in the _Layout.cshtml page to resolve the issue. Please refer the below code snippet for further details.

[_Layout.cshtml]

      <link rel='nofollow' href="@Url.Content("~/Content/ej/web/Default-theme/ej.widgets.all.min.css")" rel="stylesheet"/>

       <script src="@Url.Content("~/Scripts/jquery-1.10.2.min.js")"></script>

       <script src="@Url.Content("~/Scripts/jsrender.min.js")"></script>

       <script src="@Url.Content("~/Scripts/jquery.easing-1.3.min.js")"></script>  

      <script src="@Url.Content("~/Scripts/jquery.globalize.min.js")"></script>

      <script src="~/Scripts/globalize.culture.en-GB.min.js"></script>

      <script src="@Url.Content("~/Scripts/ej/ej.web.all.min.js")"></script>

      <script src="@Url.Content("~/Scripts/ej/ej.unobtrusive.min.js")"></script>

[cshtml]

@(Html.EJ().Grid<CurrencyFormatLocale.OrdersView>("FlatGrid")

        --------

        --------

        .Locale("en-GB")

)

Query 2:  I've tried a format string of {0:£###,##0.00} which causes a javascript error.  Anyone else managed this?

For your kind information, We are using jquery globlazie plugin to format the column values and hence please refer the below link for the possible formats used by jquery globalize.

https://github.com/jquery/globalize/tree/79ae658b842f75f58199d6e9074e01f7ce207468#numbers

And the input to the column format value should be wrapped between “{0:” and  “}” like below.

Number   :  {0:N2}

Percentage  : {0:P2}

Currency : {0:C2}

Date : {0:dd/MM/yyyy}

For your convenience we have created a simple sample and the same can be downloaded from the below link.

Sample Link: http://www.syncfusion.com/downloads/support/directtrac/118101/CurrencyFormatLocale-1648470369.zip

Please let us know if you have any concerns.

Regards,

Ajith R



Martin Ross
Replied On February 2, 2015 07:58 AM

Thanks - I had missed the ref to the culture file - didn't realise that was needed.  All working now!

Ajith R [Syncfusion]
Replied On February 3, 2015 01:32 AM

Hi Martin,

We are happy to hear that your reported issue has been resolved in your end.

Please get back to us if you need any further assistance.

Regards,

Ajith R



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;