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. Image for the cookie policy date
close icon

12000000

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?

3 Replies

AR Ajith R Syncfusion Team February 2, 2015 12:29 PM UTC

 

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: https://www.syncfusion.com/downloads/support/directtrac/118101/CurrencyFormatLocale-1648470369.zip

Please let us know if you have any concerns.

Regards,

Ajith R




MR Martin Ross February 2, 2015 12:58 PM UTC

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


AR Ajith R Syncfusion Team February 3, 2015 06:32 AM UTC

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



Loader.
Live Chat Icon For mobile
Up arrow icon