数据库中用decimal(18, 2)类型,结果GRIDVIEW中显示出来时会有这几种情况如:
-------------------------------------------
当前结果 | 想要的结果[也就是要去除多余的无效‘0’要怎么处理]
1.00 | 1
1.10 | 1.1
1.11 | 1.11-------------------------------------
用DataFormatString="{??}" HtmlEncode="False"它来进行格式化
??中的格式化代码是什么
-------------------------------------------
当前结果 | 想要的结果[也就是要去除多余的无效‘0’要怎么处理]
1.00 | 1
1.10 | 1.1
1.11 | 1.11-------------------------------------
用DataFormatString="{??}" HtmlEncode="False"它来进行格式化
??中的格式化代码是什么
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# decimal.ToDouble(Convert.ToDecimal(DataBinder.Eval(Container.DataItem,"你的数据库字段名"))) %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<%# Convert.ToDouble(DataBinder.Eval(Container.DataItem,"Func_Name")) %>
也行。