Friday, October 13, 2006
DataFormatString Doesn't Work
I think this might be old news, but it was new to me. If you are using a GridView (and potentially any DataBoundColumn) and you take advantage of the DataFormatString you will be in for a surprise--it may not work.
[Here is the "bug" report]
You must also set the HtmlEncode attribute to false. The explanation in the bug report doesn't make sense to me though. So what if the bound value is HTML encoded. Can't the format string still be applied? I guess if the datatype is changed to string then special format strings like "{0:C}" for currency or "{0:MM/dd/YYYY}" for DateTime won't work.
[Here is the "bug" report]
You must also set the HtmlEncode attribute to false. The explanation in the bug report doesn't make sense to me though. So what if the bound value is HTML encoded. Can't the format string still be applied? I guess if the datatype is changed to string then special format strings like "{0:C}" for currency or "{0:MM/dd/YYYY}" for DateTime won't work.
Comments:
Post a Comment