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");
}
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