数据网格号格式为nmaric [英] format of data grid number to nimaric

查看:85
本文介绍了数据网格号格式为nmaric的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将datagrid列格式化为以逗号表示的数字格式.这在我的最新应用程序中不起作用.我正在使用DataFormatString属性,但它返回的数字不带逗号.我什至尝试使用格式"{0:N}",但结果相同.
这是我的代码

I am trying to format a datagrid column to number format with comma. this is not working in my latest application. I am using the DataFormatString property but it returns the number without comma. I even tried the format "{0:N}", but same result.
here is my code

BoundColumn BoundColumn=new BoundColumn();
BoundColumn DataField=Store Quantity; 
BoundColumn.HeaderText=Quantity;
BoundColumn.ItemStyle-HorizontalAlign=Right;
BoundColumn.DataFormatString="{0:N}";



datagrid的源是动态创建的DataTable.



The source for the datagrid is a DataTable whcih is created dynamically.

推荐答案

确保在DataTable中,对于存储数量"列,数据类型为数值类型(int,float等).如果它是字符串,则将忽略数字格式.
Make sure that in the DataTable, for the column Store Quantity, the data type is one of the numeric types (int, float etc). If it is string, then the numeric format is ignored.


hello Aravind
在您的原始代码中,您提到了商店数量",它与哪一列相关?
hello Aravind
in your original code, you have mentioned "Store Quantity", what column is that related to?


这篇关于数据网格号格式为nmaric的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆