This documentation is archived and is not being maintained.

HtmlTextWriter.SemicolonChar Field

Represents the semicolon (;) character.

[Visual Basic]
Public Const SemicolonChar As Char
[C#]
public const char SemicolonChar;
[C++]
public: const __wchar_t SemicolonChar;
[JScript]
public var SemicolonChar : Char;

Example

[Visual Basic, C#, C++] The following code example demonstrates using the SemiColonChar field when rendering a series of style attributes on an HTML Label element.

[Visual Basic] 
Protected Overrides Sub Render(writer As HtmlTextWriter)
   writer.WriteBeginTag("label")
   writer.Write(HtmlTextWriter.SpaceChar)
   ' Output the string "style" followed by "=\"".
   writer.Write("style" + HtmlTextWriter.EqualsDoubleQuoteString)
   ' Output the style attribute "font-size".
   writer.Write("font-size" + HtmlTextWriter.StyleEqualsChar + "12pt")
   ' Output a style attribute separator.
   writer.Write(HtmlTextWriter.SemicolonChar)
   ' Output the style attribute "color".
   writer.Write("color" + HtmlTextWriter.StyleEqualsChar + "fuchsia")
   ' Output the double quote character.
   writer.Write(HtmlTextWriter.DoubleQuoteChar)
   ' Output the '>' character.
   writer.Write(HtmlTextWriter.TagRightChar)
   ' Output the 'Message' property.
   writer.Write(Message)
   ' Output the 'Message' property contents and the time on the server.
   writer.Write("<br>" + "<font color=""blue"">" + _
               "The time on the server: " + _
               System.DateTime.Now.ToLongTimeString() + "</font>")
End Sub

[C#] 
protected override void Render(HtmlTextWriter writer)
{
   writer.WriteBeginTag("label");
   writer.Write(HtmlTextWriter.SpaceChar);
   // Output the string "style" followed by "=\"".
   writer.Write("style" + HtmlTextWriter.EqualsDoubleQuoteString);
   // Output the style attribute "font-size".
   writer.Write("font-size" + HtmlTextWriter.StyleEqualsChar + "12pt");
   // Output a style attribute separator.
   writer.Write(HtmlTextWriter.SemicolonChar);
   // Output the style attribute "color".
   writer.Write("color" + HtmlTextWriter.StyleEqualsChar + "fuchsia");
   // Output the double quote character.
   writer.Write(HtmlTextWriter.DoubleQuoteChar);
   // Output the '>' character.
   writer.Write(HtmlTextWriter.TagRightChar);
   // Output the 'Message' property.
   writer.Write(Message);
   // Output the 'Message' property contents and the time on the server.
   writer.Write("<br>" + "<font color=\"blue\">" +
               "The time on the server: " +
               System.DateTime.Now.ToLongTimeString() +
               "</font>");
}

[C++] 
protected:
   void Render(HtmlTextWriter* writer)
   {
      writer->WriteBeginTag(S"label");
      writer->Write(HtmlTextWriter::SpaceChar);
      // Output the string "style" followed by "=\"".
      writer->Write(S"style{0}", HtmlTextWriter::EqualsDoubleQuoteString);
      // Output the style attribute "font-size".
      writer->Write(S"font-size{0}12pt",__box(HtmlTextWriter::StyleEqualsChar));
      // Output a style attribute separator.
      writer->Write(HtmlTextWriter::SemicolonChar);
      // Output the style attribute "color".
      writer->Write(S"color{0}fuchsia",__box(HtmlTextWriter::StyleEqualsChar));
      // Output the double quote character.
      writer->Write(HtmlTextWriter::DoubleQuoteChar);
      // Output the '>' character.
      writer->Write(HtmlTextWriter::TagRightChar);
      // Output the 'Message' property.
      writer->Write(Message);
      // Output the 'Message' property contents and the time on the server.
      writer->Write(S"<br><font color=\"blue\">The time on the server: {0}</font>",
         System::DateTime::Now.ToLongTimeString() );
   }

[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: