Show money or float values upto two decimal places using
String.Format in Gridview.
<%# String.Format("{0:f2}",DataBinder.Eval(Container.DataItem,"Rate")) %>
or
<asp:Label ID="Label1" runat="server" Text='<%# Eval("Amt","{0:f2}") %>'></asp:Label>
Example :
<asp:TemplateField HeaderText="Rate">
<ItemTemplate>
<table align="right" style="text-align: right"><tr><td align="right">
<asp:Label ID="lblRate" runat="server"
Text='<%# String.Format("{0:f2}",DataBinder.Eval(Container.DataItem,"Rate")) %>' ></asp:Label>
</td></tr></table>
</ItemTemplate>
</asp:TemplateField>
Worked like a charm :) thanks a lot !!
ReplyDeleteDecimal string formatting in GridView
ReplyDeleteI have used the same but it is not working
ReplyDeleteI am used data table decimal sum calculation but currency format used string type convert to bind gridview so controvert method solution tell me
ReplyDeletei am used dynamic grid
Delete