Gridview problem DataFormatString not working Visual Studio
Date: Monday, February 02, 2009 @ 11:24:42 UTC
Topic: What do we know?


There is a bug in older versions of the .NET 2.0 framework used for Visual Studio 2005. Even if you have a DataFormatString in your Gridview object, the column may still not format. This article has been promoted from the Group29 Forums Article Gridview problem DataFormatString not working Visual Studio


The workaround is to add the code

Code:
HtmlEncode ="false" 


to that column

When HtmlEncode is on, the data is retrieved from the data store, Html Encoded, and then the format string is applied. By HtmlEncoding the value from the data store, the framework protects unsafe script from the data store from being displayed to the client.

I have observed this in the RTM versions of .NET 2.0 2.0.50727.42, as well as .NET 2.0 with security updates including 2.0.50727.832.*

The problem does not occur in the SP1 version of .NET 2.0 (2.0.50727.1433). This SP1 came with the .NET framework 3.5. Apparently this also did not occur in the beta version of .NET 2.0.


Sample Search phrases used to find this article

.dataformatstring
.dataformatstring within code
.net 3.5 dataformatstring not working
.net 3.5 gridview boundcolumn dataformatstring property
.new dataformatstring
2.0.50727.42 dataformatstring
asp gridview dataformatstring telephone number
asp.net dataformatstring limit string length
cannot use dataformatstring with gridview
dataformatstring
dataformatstring%3d
dataformatstring - visual c
dataformatstring boundfield gridview cannot delete different type
dataformatstring convert seconds to minutes and seconds
dataformatstring currency millions
dataformatstring custom format credit card .net
dataformatstring date gridview problem
dataformatstring does not work in sp1
dataformatstring en gridiew
dataformatstring en visual studio 2005
dataformatstring for hours in grid view
dataformatstring gmt local
dataformatstring gridview
dataformatstring gridview link
dataformatstring gridview not format
dataformatstring gridview not working
dataformatstring gridview not working vs2008
dataformatstring in gridview
dataformatstring link encoded
dataformatstring miles km
dataformatstring not working .net 2.0
dataformatstring not working in gridview even if htmlencode%3d false
dataformatstring of a grid view
dataformatstring problem
dataformatstring semicolon
dataformatstring value gets updated to few columns not to the others
dataformatstring visual basic 2005
dataformatstring visual studio
dataformatstring visual studio 2005
dataformatstring visual studio 2008
dataformatstring year
framework sp1 problem dataformatstring
grid view dataformatstring problem
gridvew dataformatstring
gridview dataformatstring
gridview dataformatstring %3cpre%3e
gridview dataformatstring edit
gridview dataformatstring not work 3.5
gridview dataformatstring not working vs 2008
gridview dataformatstring semicolon
gridview format string dataformatstring
gridview htmlencode%3d false dataformatstring%3d not formatting
dataformatstring not working
number dataformatstring gridview
reader dataformatstring
sp1 framework dataformatstring
studio dataformatstring
visual basic gridview dataformatstring
visual studio 2005 dataformatstring
visual studio 2005 gridview dataformatstring
visual studio dataformatstring
visual studio dataformatstring in grid view
visual studio dataformatstring not working
visual studios 2008 dataformatstring
vs2008 gridview boundcolumn dataformatstring property htmlencode false not working
why is the dataformatstring not working







This article comes from Group29.com - What did you expect?
http://www.group29.com

The URL for this story is:
http://www.group29.com/modules.php?name=News&file=article&sid=195