asp.net.ph

BoundField.HtmlEncode Property

System.Web.UI.WebControls Namespace   BoundField Class


Sets or retrieves a value specifying whether field values are HTML-encoded before they are displayed in a BoundField.

Syntax


Inline <asp:boundfield htmlencode [ = true | false ] ... >
Script BoundField.HtmlEncode [ = true | false ]

Property Value

This property accepts or returns only a boolean value: true if field values are HTML-encoded before they are displayed in a BoundField; otherwise false. Default value is true.

Remarks

Use the HtmlEncode property to specify whether field values are HTML-encoded before they are displayed in a BoundField control.

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.

Example

The following example demonstrates how to use the HtmlEncode in conjunction with the DataFormatString property to display prices in a GridView control.

<asp:boundfield headertext = "Price"
   datafield = "Price"
   dataformatstring = "{0:c}"
   htmlencode=false
   itemstyle-horizontalalign = "right" />

 Show me 

See Also

BoundField Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph