HtmlTextWriter.OnTagRender メソッド
アセンブリ: System.Web (system.web.dll 内)

Protected Overridable Function OnTagRender ( _ name As String, _ key As HtmlTextWriterTag _ ) As Boolean
Dim name As String Dim key As HtmlTextWriterTag Dim returnValue As Boolean returnValue = Me.OnTagRender(name, key)
戻り値
常に true。

HtmlTextWriter クラスで実装されている OnTagRender メソッドは、常に true を返します。OnTagRender のオーバーライドで、ページに要素を出力するかどうかを確認できます。
継承時の注意 HtmlTextWriter クラスから継承する場合は、OnTagRender メソッドをオーバーライドして、false を返し、マークアップ要素をまったく出力しないか、または特定のマークアップ言語で出力しないようにできます。たとえば、HtmlTextWriter から派生したオブジェクトが <font> 要素を出力しないようにするには、OnTagRender メソッドをオーバーライドして、<font> 要素が格納されているページが要求された場合は false を返すようにできます。
OnTagRender メソッドをオーバーライドする方法を次のコード例に示します。Font 要素を出力する場合、OnTagRender オーバーライドは IsAttributeDefined メソッドを使用して、Size 属性を出力するかどうかを決定します。出力しない場合は、AddAttribute メソッドを使用して、Size 属性を作成し、その値を 20pt に設定します。
' If a <font> element is to be rendered, check whether it contains ' a size attribute. If it does not, add one and set its value to ' 20 points, then return true. Protected Overrides Function OnTagRender( _ name As String, _ key As HtmlTextWriterTag) _ As Boolean If (key = HtmlTextWriterTag.Font) Then If Not (IsAttributeDefined(HtmlTextWriterAttribute.Size)) Then AddAttribute(HtmlTextWriterAttribute.Size, "20pt") Return True End If End If ' If the element is not a <font> element, use ' the base functionality of the OnTagRenderMethod. Return MyBase.OnTagRender(name, key) End Function
// If a <font> element is to be rendered, check whether it contains // a size attribute. If it does not, add one and set its value to // 20 points, then return true. protected override bool OnTagRender(string name, HtmlTextWriterTag key) { if (key == HtmlTextWriterTag.Font) { if (!(IsAttributeDefined(HtmlTextWriterAttribute.Size))) { AddAttribute(HtmlTextWriterAttribute.Size, "20pt"); return true; } } // If the element is not a <font> element, use // the base functionality of the OnTagRenderMethod. return base.OnTagRender(name, key); }

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からHtmlTextWriter.OnTagRender メソッドを検索する場合は、下記のリンクをクリックしてください。

- HtmlTextWriter.OnTagRender メソッドのページへのリンク