HtmlTextWriter::OnTagRender Method
Determines whether the specified markup element will be rendered to the requesting page.
Assembly: System.Web (in System.Web.dll)
Parameters
- name
- Type: System::String
A string containing the name of the element to render.
- key
- Type: System.Web.UI::HtmlTextWriterTag
The HtmlTextWriterTag associated with the element.
The HtmlTextWriter class implementation of the OnTagRender method always returns true. The OnTagRender overrides can determine whether an element will be rendered to the page.
Notes to InheritorsIf you inherit from the HtmlTextWriter class, you can override the OnTagRender method to return false to prevent a markup element from being rendered at all or for a particular markup language. For example, if you do not want the object that is derived from HtmlTextWriter to render the <font> element, you can override the OnTagRender method to return false when a page is requested that contains a <font> element.
The following code example shows how to override the OnTagRender method. If a Font element is being rendered, the OnTagRender override uses the IsAttributeDefined method to determine whether a Size attribute is being rendered. If not, it uses the AddAttribute method to create a Size attribute and set its value to 20pt.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.