マークアップ要素の内部の内容を書き込むテキスト ライタを取得または設定します。
名前空間: System.Web.UI
アセンブリ: System.Web (system.web.dll 内)
構文
'宣言
Public Property InnerWriter As TextWriter
'使用
Dim instance As HtmlTextWriter
Dim value As TextWriter
value = instance.InnerWriter
instance.InnerWriter = value
public TextWriter InnerWriter { get; set; }
public:
property TextWriter^ InnerWriter {
TextWriter^ get ();
void set (TextWriter^ value);
}
/** @property */
public TextWriter get_InnerWriter ()
/** @property */
public void set_InnerWriter (TextWriter value)
public function get InnerWriter () : TextWriter
public function set InnerWriter (value : TextWriter)
適用できません。
プロパティ値
内部マークアップの内容を書き込む TextWriter オブジェクト。
解説
内部マークアップの内容とは、マークアップ言語の要素の開始タグと終了タグの間にあるテキストのことです。
InnerWriter プロパティが HttpWriter クラスのインスタンスである TextWriter オブジェクトに設定されている場合、これが記述され、個別の参照が保存されます。
使用例
Render メソッドをオーバーラードする WebControl クラスから派生したカスタム Web サーバー コントロールを使用する方法を次のコード例に示します。このコード例では、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.
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 'Render
End Class 'FirstControl
// 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.
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.get_InnerWriter();
innerTextWriter.Write(get_Message() + "<br> The time on the server :"
+ System.DateTime.get_Now().ToLongTimeString());
// Write the closing tag of the Font element.
writer.WriteEndTag("font");
プラットフォーム
Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition
Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。
バージョン情報
.NET Framework
サポート対象 : 3.0,2.0,1.1,1.0
参照
関連項目
HtmlTextWriter クラス
HtmlTextWriter メンバ
System.Web.UI 名前空間
TextWriter
HttpWriter
WebControl