Reputation: 1995
I have a decimal column that contains percentages. I'm converting these so that they display as their whole #
counterparts. For example, if a value is 0.35
in the database, I'm displaying it as 35
in the textbox. However, some of the values are 0.00
, but don't display in the textbox as 0
. In fact, nothing shows up at all.
What would be the proper ToString()
format to use to achieve my desired result?
Upvotes: 0
Views: 1267
Reputation: 856
See the template below:
String.Format("{0:0.00}", 123.0);
See http://www.csharp-examples.net/string-format-double/
Thus, you multiply by 100 and display without decimal places. It should work well
Upvotes: 0