HtmlTextWriter.WriteEndTag Method

Writes any tab spacing and the closing tag of the specified markup element.

Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)

public:
virtual void WriteEndTag (
	String^ tagName
)
public void WriteEndTag (
	String tagName
)
public function WriteEndTag (
	tagName : String
)
Not applicable.

Parameters

tagName

The element to write the closing tag for.

Unlike the RenderEndTag method, the WriteEndTag method has no logic to make the element end tag match the corresponding opening tag.

The following code example demonstrates rendering an <img> element. The code example uses the following process:

  • Calls the WriteBeginTag method to render the opening characters of the element.

  • Calls the two overloads of the WriteAttribute method to write attributes to the <img> element.

  • Calls the WriteEndTag method to close the <img> element.

// Create a manually rendered tag.
writer->WriteBeginTag( "img" );
writer->WriteAttribute( "alt", "AtlValue" );
writer->WriteAttribute( "myattribute", "No &quot;encoding &quot; required", false );
writer->Write( HtmlTextWriter::TagRightChar );
writer->WriteEndTag( "img" );

// Create a manually rendered tag.
writer.WriteBeginTag("img");
writer.WriteAttribute("alt", "AtlValue");
writer.WriteAttribute("myattribute", 
    "No &quot;encoding &quot; required", false);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteEndTag("img");

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: