My digital notepad RSS 2.0
 Wednesday, January 03, 2007

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 DataFormatString="{0:MMMM, yyyy}", right? Not so... It refused to apply the format string. Luckily, Google came to the resque again, Raj Kaimal had the same problem and solved it.

Turns out that the field value is HTML encoded before the format string is applied. Add a HtmlEncode="False" to the BoundField and the problem is solved. Thanks Raj!

 
Wednesday, January 03, 2007 11:24:06 PM (Central Europe Standard Time, UTC+01:00)  #    Comments [0] -
ASP.NET | Programming
Links
Twitter updates
    Archive
    <January 2007>
    SunMonTueWedThuFriSat
    31123456
    78910111213
    14151617181920
    21222324252627
    28293031123
    45678910
    About the author/Disclaimer

    Disclaimer
    The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

    © Copyright 2012
    Glenn F. Henriksen
    Sign In
    Statistics
    Total Posts: 46
    This Year: 0
    This Month: 0
    This Week: 0
    Comments: 31
    All Content © 2012, Glenn F. Henriksen
    DasBlog theme 'Business' created by Christoph De Baene (delarou)