This documentation is archived and is not being maintained.

WebControl::BackColor Property

Gets or sets the background color of the Web server control.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

virtual property Color BackColor {
	Color get ();
	void set (Color value);
<asp:WebControl BackColor="Color" />

Property Value

Type: System.Drawing::Color
A Color that represents the background color of the control. The default is Empty, which indicates that this property is not set.

Use the BackColor property to specify the background color of the Web server control. This property is set using a System.Drawing::Color object.


This property will render for only certain controls. For example, Table, Panel, DataGrid, Calendar, and ValidationSummary will render this property. It will also work for CheckBoxList, RadioButtonList and DataList if their RepeatLayout property is RepeatLayout.Table, not RepeatLayout.Flow.

In general, only controls that render as a <table> tag can display a background color in HTML 3.2, whereas almost any control can in HTML 4.0.

For controls that render as a <span> tag (including Label, all validation controls, and list controls with their RepeatLayout property set to RepeatLayout.Flow), this property will work in Microsoft Internet Explorer version 5 and later, but not in Microsoft Internet Explorer version 4.

The following example illustrates how to set the BackColor property of the Table control, which is inherited from the WebControl base class.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.