Click here to Skip to main content
14,665,418 members
Rate this:
Please Sign up or sign in to vote.
See more:
i have a kendo grid and binding values to filed where the value is 85 . i need to display 85%

{ field: "CompletePer", title: "% Complete", headerAttributes: { title: '% Complete"' }, template: '# if ( CompletePer == null || CompletePer == 0 ) { ## } else {##=kendo.format("{0:p}", CompletePer / 100)##}#', width: 100 },


What I have tried:

i tried with below one
{ field: "CompletePer", title: "% Complete", headerAttributes: { title: '% Complete"' }, template: '# if ( CompletePer == null || CompletePer == 0 ) { ## } else {##=kendo.format("{0:p}", CompletePer / 100)##}#', width: 100 },


its display 85.00% , it should be 85%
Posted
Updated 23-Apr-20 5:51am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

   
Comments
kongalshiva549 23-Apr-20 12:08pm
   
I tried P0 instead p , but it is giving same decimals
Richard Deeming 23-Apr-20 12:12pm
   
Try with a lowercase p0 as the documentation shows, in case it's case-sensitive.
kongalshiva549 23-Apr-20 15:16pm
   
Ya , i tried with lower case , no luck
kongalshiva549 24-Apr-20 9:30am
   
template: '# if ( CompletePer == null || CompletePer == 0 ) { ## } else {##=kendo.format("{0:p0}", CompletePer / 100)##}#'

Above works fine for me but iam getting some extra space like 85 % which should be like 85%
Richard Deeming 24-Apr-20 9:35am
   
Looks like you'll need a custom format string then:
template: '# if ( CompletePer == null || CompletePer == 0 ) { ## } else {##=kendo.format("{0:#\\\%}", CompletePer)##}#'
kongalshiva549 24-Apr-20 9:46am
   
Its not working.. look like we are missing something
kongalshiva549 23-Apr-20 12:09pm
   
from backend iam assign value .. for example if complete value is 85, it should display 85%

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100