String.Format as percentage based on decimal places
Posted on 2006-06-23
I need to format some values in a gridview. They all need to display as a percentage (0-100%), but only show the decimals if they exist:
99 --> 99%
86.56 --> 86.56%
75.2 --> 75.2%
Is there a way to do this automatically using string.format? If not, what's the easiest way to achieve what I need??