AttributeCollection::CssStyle Property
Gets a collection of styles for the ASP.NET server control to which the current AttributeCollection object belongs.
Assembly: System.Web (in System.Web.dll)
Property Value
Type: System.Web.UI::CssStyleCollectionA collection that contains the styles for the current server control.
Any style declared for a particular HTML server control is added to the CssStyleCollection object when the containing ASP.NET Web page is parsed. You can use this property to add, remove, and iterate through the styles declared for the server control.
The following example shows how to add a CSS style value programmatically to a server control's AttributeCollection object. When a button is clicked, the background color of a TextBox server control named TextBox1 is set to the selected item in a DropDownList server control named DropDownList1.
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.