views:

30

answers:

2

Hi all,i have a gridview that shows some indicators.one of the numbers is a computed percentage it looks like this "33.33333333333333333333333333333333333333" i tried to set the DataFormatString property of the column to several different formats such as "{0:P}" ,"{0:D}" and "{0:##.##}" but nothing worked for me to show it like that "33.34". Any ideas?

+2  A: 

What happens if you use "{0:F2}"?

Carnotaurus
Nothing happened at all.
Khaled
+1  A: 

Try entering just the format string without braces and the index,eg. P, D or ##.### . The braces and index are used by String.Format, where there are more than one format parameters. ToString methods (e.g. int.ToString) and control format parameters use only the format string without braces

Panagiotis Kanavos
Without the curly braces..it shows it as text,if i set the property DataFormatString="P" it just shows all the values in that columns as "P"
Khaled