Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Always display decimals using UK/US format?

Reply
Thread Tools

Always display decimals using UK/US format?

 
 
JDC
Guest
Posts: n/a
 
      06-28-2006
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

 
Reply With Quote
 
 
 
 
Damien
Guest
Posts: n/a
 
      06-28-2006
JDC wrote:
> 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

 
Reply With Quote
 
 
 
 
JDC
Guest
Posts: n/a
 
      06-28-2006
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.



Damien wrote:
> JDC wrote:
> > 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


 
Reply With Quote
 
Damien
Guest
Posts: n/a
 
      06-28-2006
JDC wrote:
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to force decimals to display in exponential notation revansx@cox.net ASP General 4 10-16-2006 04:29 PM
Newbie: How to format a number to always show two decimals? i.v.r. Ruby 11 11-02-2005 08:25 PM
Trying to create a CSS box that is always is always the width of an image placed inside it (and no wider) Deryck HTML 4 06-22-2004 08:25 PM
Re: Formatting Decimals Kevin Spencer ASP .Net 0 08-26-2003 04:14 PM
Formatting Decimals Kerri ASP .Net 1 08-21-2003 07:05 PM



Advertisments