Click here to Skip to main content
15,886,783 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello,
I have a "detailview" with data in float number. I have a problem with the decimal separator. I want to use the "." of the numeric pad but in Belgium, the separator is ",". I want that the "." is the same as the ",". How can I do ?
Posted

You will need to use a masked text box - something that supports cultures.
 
Share this answer
 
If your users are all in Belgium and would assume that "," is the correct separator, you should be able to just set the current culture to your Belgian culture of choice.

If you actually need support for multiple cultures you have a bit more work to do. You'll need to keep track of each user's preferred culture, then use that culture when displaying values in the UI. You should also store information in your database or other data store in the invariant culture. You can use the various item data binding events on the DetailsView to do the preferred culture <-> invariant culture conversions.
 
Share this answer
 
C#
Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
 
Share this answer
 
Thank you for the answer but that don't work.

If I put 10,25 and save it, the system return 10,25 (that's correct)
If I put 10.25 and save it, the system return 1025 (that's incorrect)

this is the code :

C#
protected void Page_Load(object sender, EventArgs e)
   {
       Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
 
Share this answer
 

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