This is a migrated thread and some comments may be shown as answers.

Culture aware number formatting

1 Answer 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Antony
Top achievements
Rank 1
Antony asked on 02 Apr 2009, 09:25 AM
Hi Everyone,

Our website allows the user to change their culture on the fly.
For example one user may be set to "fr-FR" while another set to "en-GB".

I have a radgrid with GridNumeric columns and I would like to format the numbers based on the user 's selected culture.
All the examples I can find on this site set the DataFormatString manually on each column, surely there is a way to specify the Culture for the grid which would then automatically format numbers accordingly?
If this is not the case how do I proceed as the DataFormatString will change depending on the culture as many cultures have different decimal and grouping separators?
Yes I could create a switch statement but then the code would have to be changed each time we support a new language.

Just for information purposes I am creating the grid completely in code behind in the Page_Init.

Many thanks
Antony







1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 06 Apr 2009, 05:02 PM
Hello Antony,

Please examine the sample project I attached to this thread. Let us know whether the suggested approach suits your scenario.

Best regards,
Daniel
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Antony
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or