how to set number in indian format currency

RAVI 896 Reputation points
2024-03-06T17:34:14.9666667+00:00

Hello

This is my gridview data

<asp:TemplateField HeaderText="APR">
    <FooterTemplate>
        <asp:Label ID="FA1" runat="server" Font-Size="16px" ForeColor="red"></asp:Label><br />
        <asp:Label ID="FA11" runat="server" Font-Size="16px" ForeColor="teal"></asp:Label>
    </FooterTemplate>
    <ItemTemplate>
    <asp:Label ID="A1" runat="server" Visible="false" ForeColor="Red" Text='<%#(String.IsNullOrEmpty(Eval("[April QTY]").ToString()) ? "0" : Eval("[April QTY]"))%>'
            ></asp:Label><br />
        <asp:Label ID="A11" runat="server"  ForeColor="Teal" Text='<%#(String.IsNullOrEmpty(Eval("[April VALUE]").ToString()) ? "0" : Eval("[April VALUE]"))%>'
            >
          
            </asp:Label>
    </ItemTemplate>
    <FooterStyle Font-Size="26px" ForeColor="Teal" HorizontalAlign="Right" />
    <HeaderStyle ForeColor="Black" BackColor="#FCF3CF" />
    <ItemStyle ForeColor="Teal" HorizontalAlign="Right" Width="80px" />
</asp:TemplateField>

It shows output like this

my number is 12550000

but i want like this 1,25,50,000

thanking you

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,265 questions
{count} votes

Accepted answer
  1. Lan Huang-MSFT 25,636 Reputation points Microsoft Vendor
    2024-03-07T06:54:39.81+00:00

    Hi @RAVI,

    You can use the code below.

    <asp:Label ID="A1" runat="server" ForeColor="Red" Text = '<%# String.IsNullOrEmpty(Eval("[April QTY]").ToString()) ? "0" : (String.Format(System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN"), "{0:#,#}" , decimal.Parse(Eval("[April QTY]").ToString())))%>'></asp:Label>
    

    User's image

    If you need currency symbol you can use the code below.

    <asp:Label ID="A1" runat="server" ForeColor="Red" Text = '<%# String.IsNullOrEmpty(Eval("[April QTY]").ToString()) ? "0" : (String.Format(System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN"), "{0:C0}" , decimal.Parse(Eval("[April QTY]").ToString())))%>'></asp:Label>
    

    User's image

    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful