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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Trying to set currency to UK Pounds

Thread ID:

Created:

Updated:

Platform:

Replies:

142073 Jan 17,2019 11:29 AM UTC Jan 18,2019 12:03 PM UTC ASP.NET Core - EJ 2 1
loading
Tags: DataGrid
Karl McGeough
Asked On January 17, 2019 11:29 AM UTC

Hello, I have been trying to change the currency displayed in my grid view from '$' to '£'. Is there anyway of doing this?

Thavasianand Sankaranarayanan [Syncfusion]
Replied On January 18, 2019 12:03 PM UTC

Hi Karl, 
 
Greetings from Syncfusion. 
 
Query: I have been trying to change the currency displayed in my grid view from '$' to '£'. Is there anyway of doing this?  
 
We have validated your query and created a sample based on your requirement. For Internationalization and localization, you need to include cldr files into your application. You need to download cldr-data globally in any location by using below command. 
 
Command: 
npm install cldr-data 
 
After installing cldr-data, you can find cldr-data for all locale in this location(node_modules->cldr-data->main). You need to copy the required(or all) locale cldr-data and paste into your application folder(Scripts->cldr->main->paste copied cldr files). 
 
You need to include cldr-data into your application and refer file location in index.cshtml file like below code example. Please find the below code example and sample for your reference. 

[code example] [index.cshtml] 
<div> 
    <ejs-grid id="Grid" locale="en-GB" dataSource="ViewBag.DataSource" allowPaging="true"> 
        <e-grid-pagesettings pageCount="4" pageSize="5"></e-grid-pagesettings> 
        <e-grid-columns> 
            <e-grid-column field="OrderID" headerText="Order ID" textAlign="Right" width="120"></e-grid-column> 
            <e-grid-column field="CustomerID" headerText="Customer Name" width="150"></e-grid-column> 
            <e-grid-column field="Freight" headerText="Freight" format="C2" width="120"></e-grid-column> 
            <e-grid-column field="OrderDate" headerText="Order Date" type="date" format="yMd" width="10%"></e-grid-column> 
            <e-grid-column field="ShipCountry" headerText="Ship Country" width="150"></e-grid-column> 
        </e-grid-columns> 
    </ejs-grid> 
</div> 
 
<script> 
 
 
    function loadCultureFiles(name) { 
        ej.base.setCulture(name); 
        ej.base.setCurrencyCode('GBP'); 
        var files = ['ca-gregorian.json', 'numbers.json','currencies.json', 'timeZoneNames.json']; 
        if (name === 'en-GB') { 
            files.push('numberingSystems.json'); 
        } 
        var loader = ej.base.loadCldr; 
        var loadCulture = function (prop) { 
            var val, ajax; 
            if (name === 'en-GB' && prop === files.length - 1) { 
                ajax = new ej.base.Ajax(location.origin + '/../../scripts/cldr-data/supplemental/' + files[prop], 'GET', false); 
            } else { 
                ajax = new ej.base.Ajax(location.origin + '/../../scripts/cldr-data/main/' + name + '/' + files[prop], 'GET', false); 
            } 
            ajax.onSuccess = function (value) { 
                val = value; 
            }; 
            ajax.send(); 
             
            loader(JSON.parse(val)); 
        }; 
        for (var prop = 0; prop < files.length; prop++) { 
            loadCulture(prop); 
        } 
    } 
 
    document.addEventListener('DOMContentLoaded', function () { 
        loadCultureFiles('en-GB'); 
    }); 
</script> 

Please find the sample in below link. 


Refer the help documentation. 




Please get back to us if you need further assistance. 

Regards, 
Thavasianand S. 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

;