This class is the base class for all web controls. The
WebControl class derives much of its basic
functionality from System.Web.UI.Control,
including functionality for data binding and using view state. The
WebControl class adds additional user-interface
specific members for configuring the control's
appearanceincluding a collection of CSS attributes
(Style), color options
(BackColor and ForeColor), a
shortcut key (AccessKey), and various border
style, font, and dimension properties. One interesting property that
is specific to web controls is CssClass, which
sets the Cascading Style Sheet class applied to the control. This is
rendered as the class attribute in HTML (for example,
<input type=text class="class1"
style="ForeColor:red">). Some properties, such as
AccessKey, may not be supported on down-level
browsers.
public class WebControl : System.Web.UI.Control, System.Web.UI.IAttributeAccessor {
// Public Constructors
public
WebControl (System.Web.UI.HtmlTextWriterTag
tag );
// Protected Constructors
protected
WebControl ( );
protected
WebControl (string
tag );
// Public Instance Properties
public virtual string
AccessKey {set; get; }
public AttributeCollection
Attributes {get; }
public virtual Color
BackColor {set; get; }
public virtual Color
BorderColor {set; get; }
public virtual BorderStyle
BorderStyle {set; get; }
public virtual Unit
BorderWidth {set; get; }
public Style
ControlStyle {get; }
public bool
ControlStyleCreated {get; }
public virtual string
CssClass {set; get; }
public virtual bool
Enabled {set; get; }
public virtual FontInfo
Font {get; }
public virtual Color
ForeColor {set; get; }
public virtual Unit
Height {set; get; }
public CssStyleCollection
Style {get; }
public virtual short
TabIndex {set; get; }
public virtual string
ToolTip {set; get; }
public virtual Unit
Width {set; get; }
// Protected Instance Properties
protected virtual HtmlTextWriterTag
TagKey {get; }
protected virtual string
TagName {get; }
// Public Instance Methods
public void
ApplyStyle (Style
s );
public void
CopyBaseAttributes (WebControl
controlSrc );
public void
MergeStyle (Style
s );
public virtual void
RenderBeginTag (System.Web.UI.HtmlTextWriter
writer );
public virtual void
RenderEndTag (System.Web.UI.HtmlTextWriter
writer );
// Protected Instance Methods
protected virtual void
AddAttributesToRender (System.Web.UI.HtmlTextWriter
writer );
protected virtual Style
CreateControlStyle ( );
protected override void
LoadViewState (object
savedState ); // overrides System.Web.UI.Control
protected override void
Render (System.Web.UI.HtmlTextWriter
writer ); // overrides System.Web.UI.Control
protected virtual void
RenderContents (System.Web.UI.HtmlTextWriter
writer );
protected override object
SaveViewState ( ); // overrides System.Web.UI.Control
protected override void
TrackViewState ( ); // overrides System.Web.UI.Control
}