Always display decimals using UK/US format?

J

JDC

Hi all,

Is there a recommended way (i.e. not a bodge) to get a GridView to
always display decimal numbers using a dot as the decimal separator,
regardless of the locale the user is viewing the page from? (I.e.
3.1415 not 3,1415)

Thanks in advance, Jeremy
 
D

Damien

JDC said:
Hi all,

Is there a recommended way (i.e. not a bodge) to get a GridView to
always display decimal numbers using a dot as the decimal separator,
regardless of the locale the user is viewing the page from? (I.e.
3.1415 not 3,1415)

Thanks in advance, Jeremy

Hi Jeremy,

I've seen a few messages like this in the past. Can you give me an idea
of why you would want to do this? So far as I can see, the user has
specified that it's more natural for them to view numbers using the
comma as the decimal separator, but you're deliberately wanting to
ignore that and force them to use a different convention?

Unless there's some particular narrow field of study within which
decimal dot is always used no matter where in the world someone is?

Damien
 
J

JDC

Sigh. I knew I''d get a reply like this. Yes, I have a good reason, two
of them in fact.

The data contains actual float values, but also string representations
of floats which use decimal points, not commas, and they need to stay
this way. So I need some consistency in my rows. (I have no control
over the data).

Furthermore, I have users in different countries who may not be
actually from that country, so a decision was made to use a consistent
"." notation whereever and whoever the user was.

A side benefit is that the locale of the SQL server uses this format
and it saves some mucking about, but I wouldn't have done this for just
that reason. I don't normally override user preferences or settings
arbitrarily.

I've disovered the solution is to fix a locale in web.config.
 
D

Damien

JDC said:
Sigh. I knew I''d get a reply like this. Yes, I have a good reason, two
of them in fact.

The data contains actual float values, but also string representations
of floats which use decimal points, not commas, and they need to stay
this way. So I need some consistency in my rows. (I have no control
over the data).

Furthermore, I have users in different countries who may not be
actually from that country, so a decision was made to use a consistent
"." notation whereever and whoever the user was.

A side benefit is that the locale of the SQL server uses this format
and it saves some mucking about, but I wouldn't have done this for just
that reason. I don't normally override user preferences or settings
arbitrarily.

I've disovered the solution is to fix a locale in web.config.
Hi Jeremy,

Glad you found a solution. I almost didn't post my initial comment, and
I can see now some of the reasons why you might do this (the problem
was, before, that nobody seemed to have posted a good reason to do
this). Sorry for annoying you.

Damien
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top