如何用小数位掩盖GridView单元格 [英] How to mask a gridview cell, with decimal places
问题描述
大家好,我有一个使用Gridviews显示货币数据的Web应用程序.它还将所述数据保存到sql数据库中,以备后用.所有数据都用于计算新数据,因此无论数据库的长度如何,我都需要保存小数位.现在我的问题是,在某些情况下,我不想将所述数据显示到小数点后10位.我想在显示时四舍五入,但是在Gridview中(如果有新的保存)仍然具有实际的数量,小数位和所有内容,有点像excel单元格.
我不知道这是否有可能,如果没有人对我有其他解决方案?
任何帮助将非常感激.谢谢
Hi to all, I have a web application that uses Gridviews to display currency data; it also saves said data to a sql database to be used later on. All data is used to work out new data so i need the decimal places to be saved no matter the length to the database, which is fine. Now my problem is i don''t want to display said data to 10 decimal places in some cases. I would like to round off when displayed, but have the actual amount, decimal places and all, still in the Gridview (in case of a new save), kind of like an excel cell.
I don’t know if this is at all possible, if not does anyone have another solution for me?
Any help would be much appreciated. Thanks
推荐答案
尝试使用 ^ ](如果有帮助的话).
Try to use BoundColumn.DataFormatString Property [^] if it helps.
这篇关于如何用小数位掩盖GridView单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!