XhtmlTextWriter::OnStyleAttributeRender Method
Determines whether the specified XHTML style attribute and its value can be rendered to the current markup element.
Assembly: System.Web (in System.Web.dll)
protected: virtual bool OnStyleAttributeRender( String^ name, String^ value, HtmlTextWriterStyle key ) override
Parameters
- name
- Type: System::String
The XHTML style attribute to render.
- value
- Type: System::String
The value assigned to the XHTML style attribute.
- key
- Type: System.Web.UI::HtmlTextWriterStyle
The HtmlTextWriterStyle enumeration value associated with the XHTML style attribute.
The following code example demonstrates how to override the OnStyleAttributeRender method to check whether a Color attribute is being rendered for any of the elements that are rendered by this text writer. If a Color attribute is rendered, the code checks whether its value is purple. If the value is purple, the OnStyleAttributeRender method returns false and the attribute and its value are not rendered. If the Color attribute is set to any other value, the OnStyleAttributeRender method returns true and the attribute and its value are rendered. If the key parameter of the OnAttributeRender method does not match the Color attribute, the base functionality of the OnStyleAttributeRender method is called, as defined in the XhtmlTextWriter class.
This code example is part of a larger example provided for the XhtmlTextWriter class.
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.