Always display decimals using UK/US format?

Discussion in 'ASP .Net' started by JDC, Jun 28, 2006.

  1. JDC

    JDC Guest

    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
    JDC, Jun 28, 2006
    #1
    1. Advertising

  2. JDC

    Damien Guest

    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
    Damien, Jun 28, 2006
    #2
    1. Advertising

  3. JDC

    JDC Guest

    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
    JDC, Jun 28, 2006
    #3
  4. JDC

    Damien Guest

    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
    Damien, Jun 28, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hansiman
    Replies:
    1
    Views:
    19,362
    =?Utf-8?B?S2VuIENveCBbTWljcm9zb2Z0IE1WUF0=?=
    Oct 8, 2004
  2. JeffP@Laptop

    How do I Format Currency w/out decimals?

    JeffP@Laptop, Dec 13, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    15,721
    =?Utf-8?B?RWx0b24gVw==?=
    Dec 15, 2005
  3. D. Shane Fowlkes

    Format DataItem as Currency and NO decimals

    D. Shane Fowlkes, Mar 20, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    4,903
    Nathan Sokalski
    Mar 21, 2006
  4. Tang Chun Chung

    Re: Format decimals places

    Tang Chun Chung, Jun 28, 2003, in forum: Java
    Replies:
    0
    Views:
    958
    Tang Chun Chung
    Jun 28, 2003
  5. i.v.r.
    Replies:
    11
    Views:
    254
    Logan Capaldo
    Nov 2, 2005
Loading...

Share This Page