fixed: asp.net gridview dataformatstring

A old problem was in VS 2005 and ASP.NET 2.0 that you have to set htmlencode=false to enable the dataformatstring.

Since SP1 of VS 2005 ( and ASP.NET 2.0 ) there is a new property in town HTMLEncodeFormatString which have default value false. So it is not necessary to set the value of the attribute.

<asp:BoundField DataField="RequiredDate" DataFormatString="{0:d}"

HeaderText="RequiredDate" SortExpression="RequiredDate" />

image

Published Wednesday, June 18, 2008 8:37 AM by preishuber
Filed under:

Comments

# re: fixed: asp.net gridview dataformatstring

Wednesday, June 18, 2008 1:58 PM by mcp111

sehr gut!

Ich habe vier jahre Deutsch gelernt.

# re: fixed: asp.net gridview dataformatstring

Wednesday, July 23, 2008 1:16 PM by Bruno

Hi,

if you enter the link in the post msdn.microsoft.com/.../system.web.ui.webcontrols.boundfield.htmlencodeformatstring.aspx

There we have:

"true if the text should be HTML-encoded; otherwise, false. The default is true."

That is: we still have to explicit HTMLEncodeFormatString="false"????

# Internet Radio

Wednesday, January 07, 2009 3:35 PM by Internet Radio

Das stimmt nicht immer, hier folgt eine aktuelle Auswahl von guten Hoster.

# re: fixed: asp.net gridview dataformatstring

Monday, September 28, 2009 4:12 PM by WebGrid

Hi Thanks!

I always included that property, but not anymore!

Leave a Comment

(required) 
(required) 
(optional)
(required)