Display 2 decimal places for amount in repeater control

10,399
<asp:Label Font-Size="X-Small" ID="lblTotalAmt" runat="server" Text='<%#string.Format("{0:n2}",Eval("totalamt")) %>'></asp:Label>
Share:
10,399
DNR
Author by

DNR

(msnetdevelop) This code was generated by a tool.

Updated on June 07, 2022

Comments

  • DNR
    DNR almost 2 years

    I am displaying an amount value in my repeater control (<%#Eval ("totalamt")) and would like it to be formatted to 2 decimal places. The value from the database is 2 decimal, however, the repeater is displaying 4 decimal palces.

    <asp:Label Font-Size="X-Small" ID="lblTotalAmt" runat="server" Text='<%#Eval ("totalamt") %>'></asp:Label>  
    

    How can I display this with 2 decimal places?