Export (0) Print
Expand All

HtmlTextWriter.RenderEndTag Method

Writes the end tag of an HTML element to the HtmlTextWriter output stream.

[Visual Basic]
Public Overridable Sub RenderEndTag()
[C#]
public virtual void RenderEndTag();
[C++]
public: virtual void RenderEndTag();
[JScript]
public function RenderEndTag();

Remarks

Call this method after RenderBeginTag is called and after all content between the opening and closing tags of the HTML element is rendered.

Example

[Visual Basic, C#, C++] The following example demonstrates a call to the RenderEndTag method after both the RenderBeginTag call and the Write call that renders the HTML content between the opening and closing tags of the custom MyTag element.

[Visual Basic] 
' Create a non-standard tag.
writer.RenderBeginTag("Mytag")
writer.Write("Contents of MyTag")
writer.RenderEndTag()
writer.WriteLine()

[C#] 
// Create a non-standard tag.
writer.RenderBeginTag("Mytag");
writer.Write("Contents of MyTag");
writer.RenderEndTag();
writer.WriteLine();

[C++] 
// Create a non-standard tag.
writer->RenderBeginTag(S"Mytag");
writer->Write(S"Contents of MyTag");
writer->RenderEndTag();
writer->WriteLine();

[Visual Basic] 
Public Overrides Sub RenderEndTag()
   ' Call the RenderEndTag method of the base class.
   MyBase.RenderEndTag()
   
   ' If the element being rendered is a Label, 
   ' call the PopEndTag method to write its closing tag.
   If TagKey = HtmlTextWriterTag.Label Then
      writer.Write(PopEndTag())
   End If
End Sub 'RenderEndTag
End Class 'htwThree 

[C#] 
public override void RenderEndTag()
{
   // Call the RenderEndTag method of the base class.
   base.RenderEndTag();

   // If the element being rendered is a <Label>, 
   // call the PopEndTag method to write its closing tag.
   if(TagKey == HtmlTextWriterTag.Label)
   {
       writer.Write(PopEndTag());
   }                
}

[C++] 
public:
   void RenderEndTag() {
      // Call the RenderEndTag method of the base class.
      __super::RenderEndTag();

      // If the element being rendered is a <Label>,
      // call the PopEndTag method to write its closing tag.
      if (TagKey == HtmlTextWriterTag::Label) {
         writer->Write(PopEndTag());
      }
   }

[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:
© 2014 Microsoft