System.Web.UI.HtmlControls.HtmlControl.SetAttribute Method

Sets the value of the named attribute on the System.Web.UI.HtmlControls.HtmlControl control.

Syntax

protected virtual void SetAttribute (string name, string value)

Parameters

name
The name of the attribute to set.
value
The value to set the attribute to.

Remarks

Use the HtmlControl.SetAttribute(string, string) method to set an attribute on the System.Web.UI.HtmlControls.HtmlControl server control. All HTML server controls store their attributes in the System.Web.UI.Control.ViewState property.

HTML attributes are treated by the ASP.NET page framework as properties on the HTML server control to which they belong. The HtmlControl.SetAttribute(string, string) method's name parameter is case-insensitive.

Requirements

Namespace: System.Web.UI.HtmlControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0