February 20, 2012

GridView Data Format in Indian Rs.

Below code will format the data in gridview cell in Indian Rs
for example 500 will be displayed as 500
and 4300 will be displayed as 4,300
and 123400 will be displayed as 1,23,400


 protected void gvActual_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            decimal d = decimal.Parse(e.Row.Cells[1].Text);                  
            e.Row.Cells[1].Text = String.Format("{0:N0}", d);


        }


    }


1 comment:

  1. Hi,
    Can you just show for formatting a given string.
    for example, I just pass a string to a function and it must return the formatted string...

    ReplyDelete