楼层数据格式字符串. [英] floor data format string.

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

问题描述

大家好,

我正在使用GridView显示一些数据库数据.

字段上的数字为23.89 ...我只想在
中显示"23" DataGridView,不带小数点...如果在
中使用{0:N0} DataFormatString,它返回"24".我需要将它四舍五入.

我该怎么办?

非常感谢...

Hello all,

I''m using a GridView to display some db data.

on field has the number 23.89 ... I''d like to show only "23" in the
DataGridView, without the decimals... If I use {0:N0} in the
DataFormatString, it returns "24".. I need to round it floor.

How could I do this??

Many thanks...

推荐答案

您可以使用floor 方法-
You can use the floor method - http://msdn.microsoft.com/en-us/library/system.math.floor.aspx[^].


您可以在检索数据集时执行发言,以便网格将正确显示,或者您可以按照Abhinav的建议进行操作. (那也是我的第一选择).您甚至还可以拦截OnItemDataBound并在那里手动进行发言.
You could perform the floor when you retrieve the dataset so that the grid will display correctly, or you could do what Abhinav suggests. (That would be my first choice as well). You could also intercept the OnItemDataBound even and manually perform the floor there.


这篇关于楼层数据格式字符串.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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