在Gridview Bound Field中显示十进制值 [英] Showing decimal value in Gridview Bound Field
本文介绍了在Gridview Bound Field中显示十进制值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在GridView BoundField上有一个十进制值来自sql
服务器,它在sql server中显示如下:
2096.62
14899.01
但在网格视图中显示为
2096.0000
14899.0000
我想显示这些值,如
2096.62
14899.01
我该怎么办?请帮助我。
I have a decimal value on the GridView BoundField which comes from sql
server and it shows in sql server like :
2096.62
14899.01
But show in grid view as
2096.0000
14899.0000
I want to display that values like
2096.62
14899.01
How can i do that. Please help me.
推荐答案
您好,您可以尝试使用BoundField中的DataFormatString属性
希望这个帮助你..
Hi you can try like this using DataFormatString property in BoundField
Hope this helps you..
<asp:BoundField DataField="datafield" HeaderText="header data"
ReadOnly="True" SortExpression="datafield" DataFormatString="{0:F2}" />
这篇关于在Gridview Bound Field中显示十进制值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文