c# - how to display percentage sign in gridview asp.net -


the data type column decimal(5,2) , want show in gridview this:

10% or 5% or 18% etc. 

but showing right in gridview this:

400.00% should 4%

 <asp:boundfield datafield="tot_perc" dataformatstring="{0:p}" headertext="total%" htmlencode="true" /> 

what doing wrong here? thanks

you should have dataformatstring="{0:0}%"

if want 2 decimal places, can use dataformatstring="{0:0.00}%"


as @adrianbanks mentions, dataformatstring="{0:p0}" format multiplies number 100 ... may consider storing percentage decimal(5,4) (store 50% 0.5, 25% 0.25, etc) can use dataformatstring="{0:p0}" expected.


Comments