473,395 Members | 1,653 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Always display decimals using UK/US format?

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

Jun 28 '06 #1
3 2106
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

Jun 28 '06 #2
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.

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


Jun 28 '06 #3
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

Jun 28 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Oswald | last post by:
Hey, how can I set the number of decimals? Example: 5 decimals 2.12345 2 decimals 2.12 I've found something about NumberFormat in the API, but without an example I can't solve this...
1
by: C | last post by:
Hi, I have an aspx with some labels. I set the text of these labels to be teh return value of some Functions that carry out some calculations. (My Functions return decimals) I want to...
2
by: SoLRaC | last post by:
I have a form, and i want with javascript round a number with 2 decimals to de uper next 0 or five. IE if you have the number 4,53 it must be rounded to 4,55. Until now i wrote that var valor...
6
by: Donal McWeeney | last post by:
Hi, Is there a way to specify on the predefined format strings like P and N that you want displayed all the decimals in the number... for example 3 will display 3 2.1 will display 2.1...
3
by: Chua Wen Ching | last post by:
I have a problem. But on .NET 1.1 My Scenario: Actually I will have a string of hexadecimals read from a xml file. Then from the hexadecimals, i will add 1 value whenever i made any...
7
by: Tarren | last post by:
Hi: I am pulling duration out of my DB and it returns duration in seconds. For the display i would like to show it in time format with colon So duration of 221 I want it to display 03:41 ...
3
by: desktop | last post by:
I have a program that writes something like this: 0 0 -1 0 -0.6 0.8 0 0 0.8 0 0 0 0 0 0 1 I write that with this statement:
2
by: roundcrisis | last post by:
Hi there; I m trying to find a way to create some sort of helper or something so all dates and numbers are displayed in a format (perhpas taken froma config file or database) for example in an...
8
by: =?Utf-8?B?a2FyaW0=?= | last post by:
Hello All, why is this code is not showing the result in this format: 0.00 and showing it as only 0 Private Sub btn1_Click Debug.Print(Format$(Rnd() * 100, "0.00")) Dim d As Double =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.