This documentation is archived and is not being maintained.

HtmlTextWriter.WriteLineNoTabs Method

Writes a String followed by a line terminator to an HTML text stream. This method ignores any specified tab spacing.

[Visual Basic]
Public Sub WriteLineNoTabs( _
   ByVal s As String _
)
[C#]
public void WriteLineNoTabs(
 string s
);
[C++]
public: void WriteLineNoTabs(
 String* s
);
[JScript]
public function WriteLineNoTabs(
   s : String
);

Parameters

s
The String to write to the HTML text stream.

Example

[Visual Basic] The following example shows a custom Web server control that overrides the Render method. The control renders a < label > element inside a < font > element. It uses the WriteLineNoTabs method to write the value of the custom Message property between the opening and closing tags of the < label > element.

[Visual Basic] 
' Create a Custom WebControl class.
' that renders its contents.
Public Class FirstControl
  Inherits WebControl

  ' Create a message property.
  Private _message As [String] = "Hello"
  
  ' Create the accessors for the message property.   
  Public Overridable Property Message() As [String]
     Get
        Return _message
     End Get
     Set
        _message = value
     End Set
  End Property
  
  
  ' Write the contents of the control. When this control is 
  ' included in a page that uses the CstmHtmlTW class to render
  ' its content, the Tags and elements will be changed
  ' to those specified in the overridden OnTagRender,
  ' OnAttributeRender, and OnStyleAttributeRender methods.
  Protected Overrides Sub Render(writer As HtmlTextWriter)
     writer.AddAttribute("color", "red")
     writer.AddAttribute("size", "15pt")
     writer.RenderBeginTag(HtmlTextWriterTag.Font)
     writer.AddStyleAttribute("color", "blue")
     writer.RenderBeginTag(HtmlTextWriterTag.Label)
     writer.WriteLineNoTabs(Message)
     writer.RenderEndTag()
     writer.Write(("<br>" & "The time on the server: " & _
                    System.DateTime.Now.ToLongTimeString()))
     writer.RenderEndTag()
  End Sub 'Render
End Class 'FirstControl

[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic 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: