This documentation is archived and is not being maintained.

XhtmlTextWriter::OnAttributeRender Method

Determines whether the specified XHTML attribute and its value can be rendered to the current markup element.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

protected:
virtual bool OnAttributeRender(
	String^ name, 
	String^ value, 
	HtmlTextWriterAttribute key
) override

Parameters

name
Type: System::String
The XHTML attribute to render.
value
Type: System::String
The value assigned to the XHTML attribute.
key
Type: System.Web.UI::HtmlTextWriterAttribute
The HtmlTextWriterAttribute enumeration value associated with the XHTML attribute.

Return Value

Type: System::Boolean
true if the attribute is rendered to the page; otherwise, false.

The following code example demonstrates how to override the OnAttributeRender method to check whether a size attribute is rendered for any of the elements that are rendered by this text writer. If a size attribute is rendered, the code checks whether its value is 8 point. If so, the OnAttributeRender method returns true, allowing the attribute and its value to render. If the value is other than 8 point, the OnAttributeRender method returns false, and the attribute and its value are not rendered. If the key parameter of the OnAttributeRender method does not match the Size attribute, the base functionality of the OnAttributeRender method is called, as defined in the XhtmlTextWriter class.

This code example is part of a larger example provided for the XhtmlTextWriter class.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

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.
Show: