This documentation is archived and is not being maintained.

BoundField.HtmlEncode Property

Gets or sets a value indicating whether field values are HTML-encoded before they are displayed in a BoundField object.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public:
virtual property bool HtmlEncode {
	bool get ();
	void set (bool value);
}
/** @property */
public boolean get_HtmlEncode ()

/** @property */
public void set_HtmlEncode (boolean value)

public function get HtmlEncode () : boolean

public function set HtmlEncode (value : boolean)

Not applicable.

Property Value

true if field values are HTML-encoded before they are displayed in a BoundField object; otherwise, false. The default is true.

Use the HtmlEncode property to specify whether field values are HTML-encoded to their respective string representations before they are displayed in a BoundField object.

NoteNote:

HTML-encoding field values helps to prevent cross-site scripting attacks and malicious content from being displayed. This property should be enabled whenever possible.

The following code example demonstrates how to use the HtmlEncode property to prevent field values from being HTML-encoded before being displayed in a BoundField object.

No code example is currently available or this language may not be supported.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Show: