HtmlTextWriter.FilterAttributes Method ()

 

Removes all the markup and style attributes on all properties of the page or Web server control.

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

abstract FilterAttributes : unit -> unit
override FilterAttributes : unit -> unit

Before attributes are rendered on a markup element, the FilterAttributes method is called. In turn, the FilterAttributes method calls the OnAttributeRender and OnStyleAttributeRender methods for each attribute and style to render.

The following code example shows how to use a custom class, derived from the HtmlTextWriter class, that overrides the FilterAttributes method. When called, the FilterAttributes override checks whether the text writer renders any <label> or <a> elements:

  • If a <label> element is being rendered, the FilterAttributes method checks whether a style attribute is rendered on the element and, if not, creates a style attribute and sets it to color: blue.

  • If an <a> element is being rendered, the FilterAttributes method determines whether an href attribute is included and, if not, adds an href to the URL http://www.cohowinery.com.

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

.NET Framework
Available since 1.1
Return to top
Show: