This is the base class for all HTML server controls. It includes
basic functionality—like the Disabled
property, which you can use to make a control read-only, and the
TagName property, which identifies the HTML tag
that underlies this control (for example,
"div" or
"a").
Additionally, you can set and retrieve various other properties
through the weakly typed Attributes collection,
which contains a name/value collection of all the attributes applied
to a tag. You can add a new attribute by assigning to it, as in
MyText.Attributes["onblur"]="javascript:alert('Focus
lost!');";. This statement, which adds a client-side
JavaScript event through an attribute, is the equivalent of using the
tag <input type="text" id="MyText"
onblur="javascript:alert('Focus lost!');"
runat="server"/>. Some attributes may be provided as
properties in the derived class. Another dictionary collection,
Style, allows you to specify CSS properties for a
tag (as in MyText.Style["width"] = "120px").
(Refer to Cascading Style Sheets: The Definitive
Guide (O'Reilly) for more information on
different HTML and CSS tag elements.)
public abstract class HtmlControl : System.Web.UI.Control, System.Web.UI.IAttributeAccessor {
// Public Constructors
public HtmlControl( );
public HtmlControl(string tag);
// Public Instance Properties
public AttributeCollection Attributes{get; }
public bool Disabled{set; get; }
public CssStyleCollection Style{get; }
public virtual string TagName{get; }
// Protected Instance Properties
protected override bool ViewStateIgnoresCase{get; } // overrides System.Web.UI.Control
// Protected Instance Methods
protected override ControlCollection CreateControlCollection( ); // overrides System.Web.UI.Control
protected override void Render(System.Web.UI.HtmlTextWriter writer); // overrides System.Web.UI.Control
protected virtual void RenderAttributes(System.Web.UI.HtmlTextWriter writer);
protected virtual void RenderBeginTag(System.Web.UI.HtmlTextWriter writer);
}