Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/257.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在DataGrid中显示最多两位小数且不舍入的金额_C#_Datagrid_Floating Point_Formatting_Double - Fatal编程技术网

C# 在DataGrid中显示最多两位小数且不舍入的金额

C# 在DataGrid中显示最多两位小数且不舍入的金额,c#,datagrid,floating-point,formatting,double,C#,Datagrid,Floating Point,Formatting,Double,例如,当我在Datagrid中显示一个大数字12345678.88时 使用 <asp:Label ID="txtlineAmt" runat="server" ReadOnly="true" Text='<%# Eval("DtaLineAmount", "{0:F}") %>'></asp:Label> 如果您愿意,您可以在db端执行…选择强制转换(值为十进制(10,2))我们可以不强制转换吗?选择转换(十进制(值,2))作为结果' result=st

例如,当我在Datagrid中显示一个大数字12345678.88时

使用

  <asp:Label ID="txtlineAmt" runat="server" ReadOnly="true" Text='<%# Eval("DtaLineAmount", "{0:F}") %>'></asp:Label>

如果您愿意,您可以在db端执行…选择强制转换(值为十进制(10,2))我们可以不强制转换吗?选择转换(十进制(值,2))作为结果'
result=string.Format("{0:0.0}",Math.Truncate(value*10)/10);