This documentation is archived and is not being maintained.

HtmlTextWriter.Encoding Property

Gets the Encoding that the HtmlTextWriter object uses to write content to the page.

[Visual Basic]
Overrides Public ReadOnly Property Encoding As Encoding
[C#]
public override Encoding Encoding {get;}
[C++]
public: __property Encoding* get_Encoding();
[JScript]
public override function get Encoding() : Encoding;

Property Value

The Encoding in which the HTML content is written to the page.

Example

[Visual Basic, C#, C++] The following example uses the Encoding property to write the type of HTML encoding that the FirstControl custom control uses to render text to the page that contains it.

[Visual Basic] 
' Get the value of the current HtmlTextWriter object's 
' Encoding property, convert it to a string, and 
' write it to the HtmlTextWriter stream.
writer.Write(("Encoding : " + writer.Encoding.ToString() & "<br>"))

[C#] 
// Get the value of the current HtmlTextWriter object's 
// Encoding property, convert it to a string, and 
// write it to the HtmlTextWriter stream.
writer.Write("Encoding : " + writer.Encoding.ToString() + "<br>");

[C++] 
// Get the value of the current HtmlTextWriter Object*'s
// Encoding property, convert it to a String*, and
// write it to the HtmlTextWriter stream.
writer->Write(String::Concat(S"Encoding : ", writer->Encoding, S"<br>"));

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

HtmlTextWriter Class | HtmlTextWriter Members | System.Web.UI Namespace

Show: