This topic has not yet been rated - Rate this topic

HtmlTextWriterAttribute Enumeration

Specifies the HTML attributes that an HtmlTextWriter or Html32TextWriter object writes to the opening tag of an HTML element when a Web request is processed.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)
public enum HtmlTextWriterAttribute
Member name Description
Accesskey Specifies that the HTML accesskey attribute be written to the tag.
Align Specifies that the HTML align attribute be written to the tag.
Alt Specifies that the HTML alt attribute be written to the tag.
Background Specifies that the HTML background attribute be written to the tag.
Bgcolor Specifies that the HTML bgcolor attribute be written to the tag.
Border Specifies that the HTML border attribute be written to the tag.
Bordercolor Specifies that the HTML bordercolor attribute be written to the tag.
Cellpadding Specifies that the HTML cellpadding attribute be written to the tag.
Cellspacing Specifies that the HTML cellspacing attribute be written to the tag.
Checked Specifies that the HTML checked attribute be written to the tag.
Class Specifies that the HTML class attribute be written to the tag.
Cols Specifies that the HTML cols attribute be written to the tag.
Colspan Specifies that the HTML colspan attribute be written to the tag.
Disabled Specifies that the HTML disabled attribute be written to the tag.
For Specifies that the HTML for attribute be written to the tag.
Height Specifies that the HTML height attribute be written to the tag.
Href Specifies that the HTML href attribute be written to the tag.
Id Specifies that the HTML id attribute be written to the tag.
Maxlength Specifies that the HTML maxlength attribute be written to the tag.
Multiple Specifies that the HTML multiple attribute be written to the tag.
Name Specifies that the HTML name attribute be written to the tag.
Nowrap Specifies that the HTML nowrap attribute be written to the tag.
Onchange Specifies that the HTML onchange attribute be written to the tag.
Onclick Specifies that the HTML onclick attribute be written to the tag.
ReadOnly Specifies that the HTML readonly attribute be written to the tag.
Rows Specifies that the HTML rows attribute be written to the tag.
Rowspan Specifies that the HTML rowspan attribute be written to the tag.
Rules Specifies that the HTML rules attribute be written to the tag.
Selected Specifies that the HTML selected attribute be written to the tag.
Size Specifies that the HTML size attribute be written to the tag.
Src Specifies that the HTML src attribute be written to the tag.
Style Specifies that the HTML style attribute be written to the tag.
Tabindex Specifies that the HTML tabindex attribute be written to the tag.
Target Specifies that the HTML target attribute be written to the tag.
Title Specifies that the HTML title attribute be written to the tag.
Type Specifies that the HTML type attribute be written to the tag.
Valign Specifies that the HTML valign attribute be written to the tag.
Value Specifies that the HTML value attribute be written to the tag.
Width Specifies that the HTML width attribute be written to the tag.
Wrap Specifies that the HTML wrap attribute be written to the tag.
Abbr Specifies that the HTML abbr attribute be written to the tag.
AutoComplete Specifies that the HTML autocomplete attribute be written to the tag.
Axis Specifies that the HTML axis attribute be written to the tag.
Content Specifies that the HTML content attribute be written to the tag.
Coords Specifies that the HTML coords attribute be written to the tag.
DesignerRegion Specifies that the HTML designerregion attribute be written to the tag.
Dir Specifies that the HTML dir attribute be written to the tag.
Headers Specifies that the HTML headers attribute be written to the tag.
Longdesc Specifies that the HTML longdesc attribute be written to the tag.
Rel Specifies that the HTML rel attribute be written to the tag.
Scope Specifies that the HTML scope attribute be written to the tag.
Shape Specifies that the HTML shape attribute be written to the tag.
Usemap Specifies that the HTML usemap attribute be written to the tag.
VCardName Specifies that the HTML vcardname attribute be written to the tag.

This enumeration is commonly used with the following methods of the HtmlTextWriter class: AddAttribute, GetAttributeName, IsAttributeDefined, RenderBeginTag.

The following example uses the HtmlTextWriterAttribute enumeration with the AddAttribute method to add an Onclick attribute to an HTML element and sets its value to ECMAScript code.

writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "alert('Hello');");


Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ