简体   繁体   English

字符串格式在Telerik MVC网格中不起作用

[英]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: 根据下面的文章,如果您要格式化最大的小数位数为4,但是将其切掉尾随零0,则可以使用以下方法:

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

http://www.csharp-examples.net/string-format-double 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. 我需要真正节省此网格中的空间,它需要显示超过10个费率列。 In most cases the rates only go to 2 or 3 places, but a few of them need 4. 在大多数情况下,费率仅升至2或3位,但其中一些需要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) 除非您发送已经格式化的十进制值(即转换为字符串),否则它应该一直在适合您的情况

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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