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}" />
Reactions

Post a Comment

0 Comments

Close Menu