I started to write a blog posting like this...
Instead of trying to jam decimal precision into string formatting when bubbling up (presenting) the decimal at the user interface why not just round the decimal to the precision upstream of the string formatting? This will only suck if you explicitly have to show two decimal places for, for example, a price in lieu of just showing one or none. The reason I bring this up is that if one uses a DisplayFormatString setting at a DevExpress ASPxGridView to format a percentage, there should be a way to force the percentage formatting, but I can't figure it out.
But then the clouds parted...
If you Google this problem you will find a DevExpress thread on ASPxGridView that suggests you may just shove in the formatting but if you're like me you will struggle to make that happen. Here is the appropriate way, as best as I can tell, to format a number as a percentage: <PropertiesTextEdit DisplayFormatString="{0:P}" /> This assumes you are handing in .2 for twenty percent and not 20. And, yes, you may format for dollars and cents in the same manner by using C instead of P in the markup.
No comments:
Post a Comment