本文介绍了DataFormatString在GridView中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 您好, 我有一个GridView控件,但我没有成功格式化 列来显示成本。 (简化)代码如下...... < asp:GridView ID =" grdCustomers" DataSourceID =" dtaCustomers" AutoGenerateColumns =" false" runat =" server"> < Columns> < asp:BoundField DataField =" Total" DataFormatString = QUOT;&安培;磅; {0:F2}" /> < / Columns> < / asp:GridView> 如你所见,我有将DataFormatString设置为& pound; {0:F2}, 应该给它们一个英镑符号,然后是两个 小数位的值(就像你希望看到一个成本)。 问题是数字格式不正确。我有有23.9美元的价格(我已经将英镑符号更改为1美元 符号以确保它显示在Usenet中)。这应该显示为23.90美元, 额外零。 任何想法? TIA - Alan Silver (此行下面添加的任何东西都与我无关) 解决方案 Hello,I have a GridView control, and am unsuccessfully trying to format acolumn to show costs. The (simplified) code is as follows...<asp:GridView ID="grdCustomers" DataSourceID="dtaCustomers"AutoGenerateColumns="false" runat="server"><Columns><asp:BoundField DataField="Total" DataFormatString="£{0:F2}" /></Columns></asp:GridView>As you can see, I have set the DataFormatString to "£{0:F2}",which should give them a Pound sign, followed by the value with twodecimal places (like you would expect a cost to look).The problem is that the numbers are not being formatted correctly. Ihave things like $23.9 (where I have changed the pound sign to a dollarsign to ensure it shows up right in Usenet). This should show as $23.90,with the extra zero.Any ideas? TIA--Alan Silver(anything added below this line is nothing to do with me) 解决方案 这篇关于DataFormatString在GridView中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!