Digital Colony!

DataFormatString Not Working? Here is the Fix

If you have a GridView control and are are trying to data format a BoundField, you may find your format instructions are being ignored. The fix is to add HtmlEncode="False" to the asp:BoundField. Then the DataFormatString should work.
<asp:BoundField DataField="LastModified" 
  HeaderText="Modified" 
  HtmlEncode="False" 
  DataFormatString="{0:d}" />

Labels:

posted by MAS on Feb 22,2007

Legacy Comments

Digital Colony Copyright © 1999-2010 XHTML   508
Try...Catch Disclaimer: For brevity many examples do not include error handling. That is your responsibility.