Click here to Skip to main content
15,914,419 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I need a number in number format.
I am getting a number from database without any commas, I need to seperate them with commas.
for eg: If i have 1000 it should display like 1,000
for 10000 it should display like 10,000
for 100000 it should display like 1,00,000
for 1000000 it should display like 10,00,000
and so on....

can anybody help please.

What I have tried:

I tried like this

String.FormatString("{0:#,##0}",Convert.ToDouble(HolidaysBookedThisYear))

but it is separating after avery 3 digits from last. I don't want that.
Posted
Updated 20-Apr-16 19:59pm

Try specifying an Indian culture:
C#
string s = String.Format(new CultureInfo("en-IN", false), "{0:n}", 12345678.90);
 
Share this answer
 
Comments
Garth J Lancaster 21-Apr-16 1:58am    
nice ...
Karthik_Mahalingam 21-Apr-16 2:00am    
5
Refer:
Link
 
Share this answer
 
Comments
Member 11069263 21-Apr-16 2:39am    
Thanks for your solution. It is working fine.
Karthik_Mahalingam 24-Apr-16 9:08am    
5
Animesh Datta 26-Apr-16 0:51am    
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900