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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid format not working for calculated column

Thread ID:





142987 Feb 27,2019 04:51 PM UTC Feb 28,2019 11:40 AM UTC ASP.NET Core - EJ 2 1
Tags: DataGrid
Scott Lambert
Asked On February 27, 2019 04:51 PM UTC

I have a calculated column in a grid, wont format, the calculated value works fine but the format is not applied:

HowMuch is the column value used and total is the sum of the column

My razor statement is:

<e-grid-column field="Percent" format="P2" template="<span>${HowMuch / @(total)}</span>" width="10"></e-grid-column>



Thavasianand Sankaranarayanan [Syncfusion]
Replied On February 28, 2019 11:40 AM UTC

Hi Scott, 

Greetings from Syncfusion. 

We can achieve your requirement using the numberFormat method in base. In the below code example we have do percentage format for the “EmployeeID” column which has the template. 

<ejs-grid id="Grid" dataSource="ViewBag.dataSource" allowPaging="true"  > 
    <e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true"></e-grid-editSettings> 
        <e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" textAlign="Right" width="100"></e-grid-column> 
        <e-grid-column field="CustomerID" headerText="Customer ID" width="100"></e-grid-column> 
        <e-grid-column field="EmployeeID" headerText="Employee ID" template="#coltemplate" width="100"></e-grid-column> 
        <e-grid-column field="Freight" width="100" ></e-grid-column> 
        <e-grid-column field="Verified" headerText="Verified" width="100"></e-grid-column> 
<script id="coltemplate" type="text/template" > 
    <span>${format(data)}</span>  // we pass row data to the format function 
    var format = function (value) { 
        var intl = new ej.base.Internationalization(); 
        var emp = 100; 
        var formattedValue = intl.formatNumber(value.EmployeeID/emp, { 
            format: 'P2' }); // Format teh template value and also we made the calculation in here 
        return formattedValue; 

Refer the help documentation. 

Thavasianand S. 


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

Live Chat Icon For mobile
Live Chat Icon