Click here to Skip to main content
15,914,410 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a form that has ten textboxes on it. I am using VS 2010 ASP.NET with C#. What I am trying to do is to have the textbox to display commas when a user types in numbers. I don't want the numbers with commas to be entered into the database. Right now I have full numbers in the database and if a user wants to see the data that they just entered it should show the data with the commas in the textbox but the data in the database is not changed. Is there a way for me to do this?
Posted
Updated 2-Jul-14 3:36am
v2
Comments
George Jonsson 2-Jul-14 10:09am    
Why not use the event TextChanged and prevent commas from being entered if the Locale doesn't allow that.
In some places a comma is used as the decimal mark in numbers in e.g. Sweden and Spain.
Computer Wiz99 7-Jul-14 10:52am    
That is not what I am trying to do. What I am trying to do is to take a textbox and have it to display commas when numbers are typed in. So if I type in 2000 in the textbox it should display 2,000. How can I get this display to show like that?

1 solution

After retrieving the number from database, proceed to ask Google[^].
 
Share this answer
 
v2
Comments
Computer Wiz99 2-Jul-14 8:40am    
Peter Leow, Is it better to add a Masked Class so that it will not fail or get caught in a loop?

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