次の方法で共有


HtmlTextWriter.WriteLineNoTabs メソッド

String を HTML テキスト ストリームに書き込み、続けて行終端記号を書き込みます。このメソッドは、指定されたタブ空白文字を無視します。

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

パラメータ

  • s
    HTML テキスト ストリームに書き込む文字列。

使用例

[Visual Basic] Render メソッドをオーバーライドしたカスタム Web サーバー コントロールの例を次に示します。このコントロールは、< font > 要素の中に < label >要素を表示します。また、 WriteLineNoTabs メソッドを使用して、< label > 要素の開始タグと終了タグの間にカスタムの Message プロパティの値を書き込みます。

 
' 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] C#、C++、および JScript のサンプルはありません。Visual Basic のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ

参照

HtmlTextWriter クラス | HtmlTextWriter メンバ | System.Web.UI 名前空間