简体   繁体   中英

String Formats not working in Telerik MVC Grid

According to the following article, if you want to format the max number of decimal places to say 4, but have it chop off trailing zeros 0, you use something like this:

columns.Bound(p => p.Rate).Width(52).Format("{0:####.####}")

http://www.csharp-examples.net/string-format-double

But it doesn't remove the trailing zeros. I need to really save space in this grid, it has like over 10 rate columns that need to be displayed. In most cases the rates only go to 2 or 3 places, but a few of them need 4.

Steve

There is nothing wrond with your formating. It should have been working for your case, unless you send your decimal values already formatted (ie converted into string)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM