Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6014761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:44:22+00:00 2026-05-23T02:44:22+00:00

I have spent so much time trying to figure out how numbers work in

  • 0

I have spent so much time trying to figure out how numbers work in different cultures in C#. I have sorted all the scenarios except when adding a number to datatable. In db I have number in US format (e.g. 1.32), in frontend if the culture is german then it show 1,32 in grid.

I can convert 1.32 to 1,32 using

Convert.ToDouble("1.32").ToString(Culture.GetCultureInfo("de-DE"))

but when I add this into a data table in a column of type double it becomes 132.0.

the number in db is of type double. This is how I try to convert it into proper culture format:

dt.Rows.Add(new Object[] { Convert.ToDecimal(ds.Tables[0].Rows[i][5]).ToString(culture.NumberFormat) })

One way would be to format the number in rowdatabound event of grid but is this a proper solution? There should be a way to store culture specific number in datatable.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:44:23+00:00Added an answer on May 23, 2026 at 2:44 am

    When you save the value to the database/datatable it should be of type double not string. A double value does not care about formatting, only when it is converted (and displayed) as a string.

    As for formatting goes, the GridView uses the culture specified in CultureInfo.CurrentCulture (can be changed from code). But you can also set you specific formatting on BoundField using property DataFormatString

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have spent WAY too much time trying to figure out how to pull
I've spent so much time the last few days trying to work out some
I have spent way too much time trying to sort this little issue out.
This problem may be a bug. i have spent too much time trying to
I have spent way too much time trying to solve what seems to be
Question to die hard asp.net experts. I have spent much time trying to find
This is probably simple, but I have spent way too much time trying to
I have spent much time looking for a special package that could run the
I have spent way too much time looking for the files owner icon to
I have spent all Friday and Saturday on this and I am running out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.