Gridview DataFormatString not working

I have really been struggling lately with the Gridview.  Most of the time I like to use a label, literal or placeholder in a template column so this does not really affect me.  But I still use a BoundColumn for some fields, like a date or price type thing.  In DataGrids I always was able to use DataFormatString="{0:c} for a currency format and DataFormatString="{0:d}" for a date.

To my surprise this did not work in the GridView.  After a little research I found the GridView has a new BoundField property, HTMLEncode.  You must set HTMLEncode=false to get your DataFormatString expression to be applied to your data.  I did this and voila, property formatting.

Share This Article With Your Friends!

Googles Ads Facebook Pixel Bing Pixel LinkedIn Pixel