Thursday 5 January 2012

display currency as Rs. 1,594.00

We can display the currency like this

by writing few lines of code


foreach (GridViewRow item in grdBill.Rows)
        {
            Label lblPrc = item.FindControl("lblPrice") as Label;
            double f = Convert.ToDouble(lblPrc.Text);
            System.Globalization.NumberFormatInfo nfi;
            nfi = new System.Globalization.NumberFormatInfo();
            nfi.CurrencyGroupSeparator = ",";
            nfi.CurrencySymbol = "Rs. ";
            lblPrc.Text = string.Format(nfi, "{0:C}", f);
            //lblPrc.Text=f.ToString("C");
        }

No comments:

Post a Comment

Contact Us:

Email:

Vinodkumar434@gmail.com,
vinodtechnosoft@gmail.com

Skype Name:

vinodtechnosoft