HtmlTextWriter.WriteEncodedText Method
.NET Framework 3.0
Encodes the specified text for the requesting device, and then writes it to the output stream.
Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)
Assembly: System.Web (in system.web.dll)
Use the WriteEncodedText method when a string contains angle brackets (< or >) or an ampersand (&).
The WriteEncodedText method uses the HtmlEncode method to perform the encoding and also converts Unicode character 00A0 to .
The following code example shows how to use the WriteEncodedText method to write the encoded markup <custID> & <invoice#> to the output stream. The WriteBreak method writes <br />.
// Assign a value to a string variable, // encode it, and write it to a page. colHeads = "<custID> & <invoice#>"; writer.WriteEncodedText(colHeads); writer.WriteBreak();
Community Additions
ADD
Show: