Writes any tab spacing and the opening tag of the specified markup element to the output stream.
Assembly: System.Web (in System.Web.dll)
The method does not write the closing angle bracket (>) of the markup element's opening tag. This allows the writing of markup attributes to the opening tag of the element. Use the TagRightChar constant to close the opening tag when calling the method. Use the method with the SelfClosingTagEnd constant when you write markup elements that are self-closing.
The method is used by custom server controls that do not allow tag or attribute mapping and render markup elements in the same way for each request.
The following code example demonstrates rendering an <img> element in which both overloads of the WriteAttribute method are called. The code example uses the following process:
Calls the method, which renders the opening characters of the element.
Calls the WriteAttribute(String, String) overload, which writes an alt attribute and its value to the <img> element.
Calls the WriteAttribute(String, String, Boolean) overload to render a custom myattribute attribute, with a value of No "encoding" required, and then sets fEncode to false.
Closes the opening tag of the element, and then calls the WriteEndTag method to close the <img> element.
This code example generates the following markup:
<img alt="AtlValue" myattribute="No "encoding" required">
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.