<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Glenn F. Henriksen - ASP.NET</title>
    <link>http://www.henriksen.no/</link>
    <description>My digital notepad</description>
    <language>en-us</language>
    <copyright>Glenn F. Henriksen</copyright>
    <lastBuildDate>Wed, 03 Jan 2007 22:24:06 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>blog@henriksen.no</managingEditor>
    <webMaster>blog@henriksen.no</webMaster>
    <item>
      <trackback:ping>http://www.henriksen.no/Trackback.aspx?guid=478b6245-805e-4730-83dd-3ee0ac591a8f</trackback:ping>
      <pingback:server>http://www.henriksen.no/pingback.aspx</pingback:server>
      <pingback:target>http://www.henriksen.no/PermaLink,guid,478b6245-805e-4730-83dd-3ee0ac591a8f.aspx</pingback:target>
      <dc:creator>Your DisplayName here!</dc:creator>
      <wfw:comment>http://www.henriksen.no/CommentView,guid,478b6245-805e-4730-83dd-3ee0ac591a8f.aspx</wfw:comment>
      <wfw:commentRss>http://www.henriksen.no/SyndicationService.asmx/GetEntryCommentsRss?guid=478b6245-805e-4730-83dd-3ee0ac591a8f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I have a GridView with a BoundField containing a DateTime value, but instead of "01.07.2006
00:00:00" I wanted it to display "June, 2007". Easily fixed with a <font color="#ff0000" size="2">DataFormatString</font><font color="#0000ff" size="2">="{0:MMMM,
yyyy}"</font>, right? Not so... It refused to apply the format string. Luckily, Google
came to the resque again, <a href="http://weblogs.asp.net/rajbk/archive/2005/10/31/429090.aspx">Raj
Kaimal had the same problem and solved it</a>. 
</p>
        <p>
Turns out that the field value is HTML encoded before the format string is applied.
Add a <font color="#ff0000" size="2">HtmlEncode</font><font color="#0000ff" size="2">="False"</font> to
the BoundField and the problem is solved. Thanks Raj!
</p>
        <img width="0" height="0" src="http://www.henriksen.no/aggbug.ashx?id=478b6245-805e-4730-83dd-3ee0ac591a8f" />
      </body>
      <title>DataFormatString not being applied to a BoundField</title>
      <guid isPermaLink="false">http://www.henriksen.no/PermaLink,guid,478b6245-805e-4730-83dd-3ee0ac591a8f.aspx</guid>
      <link>http://www.henriksen.no/2007/01/03/DataFormatStringNotBeingAppliedToABoundField.aspx</link>
      <pubDate>Wed, 03 Jan 2007 22:24:06 GMT</pubDate>
      <description>&lt;p&gt;
I have a GridView with a BoundField containing a DateTime value, but instead of "01.07.2006
00:00:00" I wanted it to display "June, 2007". Easily fixed with a &lt;font color=#ff0000 size=2&gt;DataFormatString&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="{0:MMMM,
yyyy}"&lt;/font&gt;, right? Not so... It refused to apply the format string. Luckily, Google
came to the resque again, &lt;a href="http://weblogs.asp.net/rajbk/archive/2005/10/31/429090.aspx"&gt;Raj
Kaimal had the same problem and solved it&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
Turns out that the field value is HTML encoded before the format string is applied.
Add a &lt;font color=#ff0000 size=2&gt;HtmlEncode&lt;/font&gt;&lt;font color=#0000ff size=2&gt;="False"&lt;/font&gt;&amp;nbsp;to
the BoundField and the problem is solved. Thanks Raj!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.henriksen.no/aggbug.ashx?id=478b6245-805e-4730-83dd-3ee0ac591a8f" /&gt;</description>
      <comments>http://www.henriksen.no/CommentView,guid,478b6245-805e-4730-83dd-3ee0ac591a8f.aspx</comments>
      <category>ASP.NET</category>
      <category>Programming</category>
    </item>
  </channel>
</rss>