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
    <August 2010>
    SunMonTueWedThuFriSat
    25262728293031
    1234567
    891011121314
    15161718192021
    22232425262728
    2930311234
    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 2010
    Glenn F. Henriksen
    Sign In
    Statistics
    Total Posts: 48
    This Year: 0
    This Month: 0
    This Week: 0
    Comments: 31
    All Content © 2010, Glenn F. Henriksen
    DasBlog theme 'Business' created by Christoph De Baene (delarou)