WebControl Class
Serves as the base class that defines the methods, properties and events common to all controls in the System.Web.UI.WebControls namespace.
Assembly: System.Web (in System.Web.dll)
[ThemeableAttribute(true)] [AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)] [AspNetHostingPermissionAttribute(SecurityAction::InheritanceDemand, Level = AspNetHostingPermissionLevel::Minimal)] public ref class WebControl : public Control, IAttributeAccessor
<asp:WebControl />
The WebControl class provides the properties, methods, and events that are common to all Web server controls. You can control the appearance and behavior of a Web server control by setting properties defined in this class. For example, the background color and font color of a control are controlled by using the BackColor and ForeColor properties, respectively. On controls that can display a border, you can control the border width, the border style, and the border color by setting the BorderWidth, BorderStyle, and BorderColor properties. The size of a Web server control can be specified by using the Height and Width properties.
The behavior of the control can be specified by setting certain properties. You can enable and disable a control by setting the Enabled property. The place of the control in the tab order is controlled by setting the TabIndex property. You can specify a ToolTip for the control by setting the ToolTip property.
Note: |
|---|
Not all controls support every property defined in this class. For specific information about whether a property is supported, see the documentation for the specific control. |
Note: |
|---|
Some properties in this class render differently, depending on the browser. Some properties do not render at all, while others render, but have no effect. The TagWriter property of the HttpBrowserCapabilities object determines the way in which a Web server control renders. For browsers that support HTML 4.0, the TagWriter property will contain a regular HttpBrowserCapabilities object, and most properties will be rendered using HTML 4.0 style attributes. Browsers that are not known to support HTML 4.0 will use the Html32TextWriter object. This will automatically map the style attributes to any relevant HTML 3.2 tag attributes. In some cases, such as with the ForeColor property, the style attributes will be converted into additional tags, such as <font> tags. In some cases, there will be no mapping performed. For specific information about how a property is rendered in different browsers, see the documentation for the specific property. |
For a list of initial property values for an instance of WebControl, see the WebControl constructor.
| Topic | Location |
|---|---|
| Developing Custom Data-Bound Web Server Controls for ASP.NET 1.1 | Authoring ASP.NET Controls |
| Walkthrough: Creating a Basic Control Designer for an ASP.NET Web Server Control | Authoring ASP.NET Controls |
| Walkthrough: Developing and Using a Custom Server Control | Authoring ASP.NET Controls |
| Walkthrough: Creating a Custom Data-Bound ASP.NET Web Control for ASP.NET 1.1 | Authoring ASP.NET Controls |
| How to: Set ASP.NET Server Control Style Properties Using ASP.NET Syntax | Building ASP .NET Web Applications |
| Walkthrough: Developing and Using a Custom Server Control | Authoring ASP.NET Controls |
| Walkthrough: Creating a Basic Control Designer for an ASP.NET Web Server Control | Authoring ASP.NET Controls |
| Developing Custom Data-Bound Web Server Controls for ASP.NET 1.1 | Authoring ASP.NET Controls |
| Walkthrough: Creating a Custom Data-Bound ASP.NET Web Control for ASP.NET 1.1 | Authoring ASP.NET Controls |
| How to: Set ASP.NET Server Control Style Properties Using ASP.NET Syntax | Building ASP .NET Web Applications |
- AspNetHostingPermission
for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
- AspNetHostingPermission
for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.
System.Web.UI::Control
System.Web.UI.WebControls::WebControl
System.Web.UI::ScriptControl
System.Web.UI.WebControls::BaseDataBoundControl
System.Web.UI.WebControls::BaseDataList
System.Web.UI.WebControls::Button
System.Web.UI.WebControls::Calendar
System.Web.UI.WebControls::CheckBox
System.Web.UI.WebControls::CompositeControl
System.Web.UI.WebControls::DataListItem
System.Web.UI.WebControls::FileUpload
System.Web.UI.WebControls::HyperLink
System.Web.UI.WebControls::Image
System.Web.UI.WebControls::Label
System.Web.UI.WebControls::LinkButton
System.Web.UI.WebControls::LoginName
System.Web.UI.WebControls::Panel
System.Web.UI.WebControls::SiteMapNodeItem
System.Web.UI.WebControls::Table
System.Web.UI.WebControls::TableCell
System.Web.UI.WebControls::TableRow
System.Web.UI.WebControls::TextBox
System.Web.UI.WebControls::ValidationSummary
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note: