Style::BackColor Property
Gets or sets the background color of the Web server control.
Assembly: System.Web (in System.Web.dll)
[TypeConverterAttribute(typeof(WebColorConverter))] public: property Color BackColor { Color get (); void set (Color value); }
Property Value
Type: System.Drawing::ColorA System.Drawing::Color that represents the background color of the control. The default is Color::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.
Note: |
|---|
This property will render only for 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, and 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 or later, but not for Microsoft Internet Explorer version 4.
This example demonstrates how to use a Style object to change the style properties of multiple controls at once. Each time one of the Style property values changes, each control must call its ApplyStyle method. Note that not all the controls included support all the properties demonstrated. If a control does not support a particular property, the appearance of the control will not change when the property value is changed.
Note: |
|---|
The following code sample uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code sample must be copied into an empty text file that has an .aspx extension. For more information on the Web Forms code model, see ASP.NET Web Page Code Model. |
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: