Welcome to MSDN Blogs Sign in | Join | Help

GridView: Formatting doesn't apply on "Money" data type using DataFormatString

Today, I was trying my hands with GridView. It was a very simple ASP.NET page where I was displaying Products in a grid. The Product Table has a column "Price" of "Money" Db Type. When I was fetching the data in the grid, I was getting the format as "0.0000". Since none of my products require more that 2 decimal places, i tried all the combination with DataFormatString like "{0:f2}" or "{0:C}" . At last I found the solution, I turned "HTMLEncode" to Off and then the DataFormatString started its magic.

It worked.

Published Sunday, November 12, 2006 5:35 AM by sajoshi

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Technological Intelligence GridView Formatting doesn t apply on | Paid Surveys

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker