BoundField::HtmlEncode Property
Gets or sets a value indicating whether field values are HTML-encoded before they are displayed in a BoundField object.
Assembly: System.Web (in System.Web.dll)
Property Value
Type: System::Booleantrue 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. For example, if this property is true, a string value of "<script>" would be rendered as "<script>". If this property is false, the string would be rendered unchanged.
Note |
|---|
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.
Available since 2.0
