I have this field from the database which is:
DataType: Numeric (7, 3)
So will allow max number
9999.99
Into the database.
I put the number
10.000
Into the database, and now I’m retrieving out of the database using:
<asp:GridView>
I specify:
<asp:BoundField DataFormatString="{0:p}" />
And it outputs
1,000.00%
Which is suppose to be
10.00%
Why isn’t it?
I also can’t put <% %> server runtime tags into a:
<asp:TemplateField />
Why is this?
Percentages are stored as decimals where 0 = 0% and 1 = 100%. You should store your value as 0.1, not 10.
The line
<asp:BoundField DataFormatString="{0:p}" />will format your value of 10.000 to 1,000.00%.See here