HtmlTextWriter.InnerWriter 속성

정의

태그 요소의 내부 내용을 쓰는 텍스트 작성기를 가져오거나 설정합니다.

public:
 property System::IO::TextWriter ^ InnerWriter { System::IO::TextWriter ^ get(); void set(System::IO::TextWriter ^ value); };
public System.IO.TextWriter InnerWriter { get; set; }
member this.InnerWriter : System.IO.TextWriter with get, set
Public Property InnerWriter As TextWriter

속성 값

TextWriter

내부 태그 내용을 쓰는 TextWriter입니다.

예제

다음 코드 예제에서는 메서드를 재정의 하는 클래스에서 WebControl 파생 된 사용자 지정 웹 서버 컨트롤을 Render 사용 하는 방법을 보여 줍니다. 클래스를 HtmlTextWriter 사용하여 요소를 작성합니다 <font> . 요소의 여는 태그를 작성한 후 속성을 사용하여 InnerWriter 문자열을 작성하고 이 문자열 "<br> The time on the server:" 을 속성 값 DateTime.Now 과 연결합니다.

   // Write the opening tag of a Font element.
   writer->WriteBeginTag( "font" );
   
   // Write a Color style attribute to the opening tag
   // of the Font element and set its value to red.
   writer->WriteAttribute( "color", "red" );
   
   // Write the closing character for the opening tag of
   // the Font element.
   writer->Write( '>' );
   
   // Use the InnerWriter property to create a TextWriter
   // object that will write the content found between
   // the opening and closing tags of the Font element.
   // Message is a string property of the control that
   // overrides the Render method.
   TextWriter^ innerTextWriter = writer->InnerWriter;
   innerTextWriter->Write( String::Concat( Message, "<br> The time on the server : ", System::DateTime::Now.ToLongTimeString() ) );
   
   // Write the closing tag of the Font element.
   writer->WriteEndTag( "font" );
}
    // Write the opening tag of a Font element.
    writer.WriteBeginTag("font");
    // Write a Color style attribute to the opening tag
    // of the Font element and set its value to red.
    writer.WriteAttribute("color", "red");
    // Write the closing character for the opening tag of
    // the Font element.
    writer.Write('>');

    // Use the InnerWriter property to create a TextWriter
    // object that will write the content found between
    // the opening and closing tags of the Font element.
    // Message is a string property of the control that 
    // overrides the Render method.
    TextWriter innerTextWriter = writer.InnerWriter;
    innerTextWriter.Write(Message + "<br> The time on the server :" + System.DateTime.Now.ToLongTimeString());

    // Write the closing tag of the Font element.
    writer.WriteEndTag("font");
}
        ' Write the opening tag of a Font element.
        writer.WriteBeginTag("font")
        ' Write a Color style attribute to the opening tag
        ' of the Font element and set its value to red.
        writer.WriteAttribute("color", "red")
        ' Write the closing character for the opening tag of
        ' the Font element.
        writer.Write(">")

        ' Use the InnerWriter property to create a TextWriter
        ' object that will write the content found between
        ' the opening and closing tags of the Font element.
        ' Message is a string property of the control that 
        ' overrides the Render method.
        Dim innerTextWriter As TextWriter = writer.InnerWriter
        innerTextWriter.Write((Message + "<br> The time on the server :" & _
           System.DateTime.Now.ToLongTimeString()))

        ' Write the closing tag of the Font element.
        writer.WriteEndTag("font")
    End Sub
End Class

설명

내부 태그 콘텐츠는 태그 언어 요소의 여는 태그와 닫는 태그 사이에 있는 텍스트입니다.

속성이 InnerWriter 클래스의 HttpWriter 인스턴스인 TextWriter 개체로 설정된 경우 이 팩트가 기록되고 별도의 참조가 저장됩니다.

적용 대상

추가 정보