System.Web.UI.WebControls.WebControl.Attributes Property

Gets the collection of arbitrary attributes (for rendering only) that do not correspond to properties on the control.

Syntax

[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
[System.ComponentModel.Browsable(false)]
public System.Web.UI.AttributeCollection Attributes { get; }

Value

a System.Web.UI.AttributeCollection

Remarks

The WebControl.Attributes collection contains a collection of all attributes declared in the opening tag of a Web server control. This allows you to programmatically control the attributes associated with a Web server control. You can add attributes to the collection or remove attributes from the collection.

Note:

This property is rendered with all attributes in the collection in the control’s opening tag, regardless of the browser settings. Not all browsers support every attribute that is rendered. The unsupported attributes are usually ignored by the browser.

Note:

You cannot add client-side script to a System.Web.UI.WebControls.WebControl instance using the WebControl.Attributes collection. To add client-side script, use the System.Web.UI.Page.ClientScript property on the System.Web.UI.Page control.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0