System.Web.UI.HtmlTextWriter.WriteAttribute Method

Writes the specified markup attribute and value to the output stream, and, if specified, writes the value encoded.

Syntax

public virtual void WriteAttribute (string name, string value, bool fEncode)

Parameters

name
The markup attribute to write to the output stream.
value
The value assigned to the attribute.
fEncode
true to encode the attribute and its assigned value; otherwise, false.

Remarks

Use the HtmlTextWriter.WriteAttribute(string, string, bool) method to write markup attributes and their values with or without encoding. The HtmlTextWriter.WriteAttribute(string, string, bool) method uses the System.Web.HttpUtility.HtmlAttributeEncode(string, System.IO.TextWriter) method to do the encoding.

The HtmlTextWriter.WriteAttribute(string, string, bool) method writes the attribute value enclosed in double quotation marks ("). If value is null, the HtmlTextWriter.WriteAttribute(string, string, bool) method writes only the attribute name.

Requirements

Namespace: System.Web.UI
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0