HtmlTextWriter.WriteEndTag Method
.NET Framework 2.0
Writes any tab spacing and the closing tag of the specified markup element.
Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)
Assembly: System.Web (in system.web.dll)
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 "encoding " 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 "encoding " required", false);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteEndTag("img");
Community Additions
ADD
Show: