Monday 13 August 2007

DataFormatString - Formatting Data in a GridView -HTMLEncode to false

The data in a datagrid can be formatted using the DataFormatString. For example you can add a £ sign or make sure the numbers are formatted to 2 decimal points and so on. The link below gives you a reference list of the things you can do but the most important point is, you need to set the HtmlEncode Property to false, or else you will not get the desired results. This one can get you because it is not stated clearly anywhere and spent half an hour trying to figure out why it wasnt working!

http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.boundfield.dataformatstring.aspx

1 comment:

Unknown said...

I actually enjoyed reading through this posting.Many thanks.








Data Formatting Services