Reputation: 485
I'm developing an MVC3 application and I have the problem that many users according with their preferences prefer dot as decimal separator or comma (for example the download of Excel files using a csv file with changed extension required a specific format for avoiding user have to replace dot for comma and viceversa). My solution for now is a radiobutton and store everything as string and replace the default by the selected value (comma or dot) There is another solution which avoid the transformation of everything to string?
Upvotes: 0
Views: 109
Reputation: 16378
Yeah, CultureInfo. Store things internaly using a predefined CultureInfo (whatever is local to your region). Associate the radion button values to cultures that are using dot (english) or comma(french) and then serve the values using the chosen culture info.
The point is you keep the values internally using ONE format then use the desired culture info to display them.
Upvotes: 1