Monday, December 12, 2011

Display the Amount in thousands and hundreds format in c#

thosands format
Here i am going to share a simple trick to display the amount in thousands and hundreds format that means, Normally we are storing the amount in decimals or money datatype format in database.when we are retrieving these values from database to display in front end. Then the amount will be displays in this format 123456.00.
if you convert these values in thousands and hundreds format.then this amount look like this 1,23,456.Its very simple conversion. just add this code.

 In c#

Add this code in .cs 

txtAmount.Text = totalamount.ToString("#,##0.##"); 

If you want to convert this value in design mode it self.then just add this code 

 <%# Eval("totalamount", "{0:n}")%> 

OUTPUT:1,23,456

 That's it..I hope this will helps.

Labels: , ,