Click here to Skip to main content
15,867,870 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

 
Share this answer
 
Comments
Chinnu2020 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.
Chinnu2020 23-Apr-20 15:16pm    
Ya , i tried with lower case , no luck
Chinnu2020 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)##}#'

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900