Pass-Through Attribute Behavior at Run-Time

Most server control tags are replaced by Microsoft IIS at runtime with one or more HTML tags in the actual HTTP response sent to the client.  The type and syntax of the HTML tag(s) is determined at runtime by the control's properties and the client's browser type.  Most of these controls will "pass through" any attributes that do not correspond to one of their control properties as attributes of the HTML tag.  For example, the GEN:Label code generation tag corresponds to a Label server control.  Label server controls do not have an "OnClick" property, but if you add something like

OnClick="'alert('Hello.');"

as an attribute of the Label's tag, it will render as something like

<span id=... OnClick="alert('Hello.');" ... />

Therefore, each server control supports an additional set of pass-through attributes that correspond to the HTML attributes of the HTML tags they render as during runtime.

Since most of the server control properties affect the HTML tags and/or attributes rendered by the control, it is possible for an HTML pass-through to conflict with a server control pass-through.  For example, if a DropDownList's AutoPostBack property equals True, it will render as an "OnChange" attribute of the HTML SELECT tag rendered at runtime.  If the DropDownList also had an HTML pass-through attribute named "OnChange" (e.g. OnChange="return false;"), the two would conflict and problems may occur.  Therefore, the list of valid pass-through attributes, the valid values of each of them, and the effect of the valid values often varies depending on the presence and values of other pass-through attributes or properties.

The presence and/or value of specific pass-through attributes could, in some cases, be affected by code customization (making the attributes be ignored, have a different effect, etc.) and/or affect code customization (making certain customizations impossible, harder, or work differently).  This case is rare, though.

See Also

Pass-Through Attributes

Generating Applications with Pass-Through Attributes

Overriding Pass-Through Attributes

Examples of Pass-Through Attributes

Setting Initial Values with Pass-Through Attributes