WebControl.Style Property
Assembly: System.Web (in system.web.dll)
/** @property */ public CssStyleCollection get_Style ()
public function get Style () : CssStyleCollection
Not applicable.
Property Value
A CssStyleCollection that contains the HTML style attributes to render on the outer tag of the Web server control.Use the Style collection to manage the style attributes rendered in the outer tag of the Web server control. This property will render on all browsers for all controls.
Note: |
|---|
| Browsers that do not support style attributes will ignore the rendered HTML. |
Any style values set through the strongly typed style properties (for example, BackColor="Red") will automatically override a corresponding value in this collection.
Values set in this collection are not automatically reflected by the strongly typed style properties.
| Topic | Location |
|---|---|
| How to: Set ASP.NET Server Control Style Properties Programmatically | Building ASP .NET Web Applications |
| How to: Set ASP.NET Server Control Style Properties Programmatically | Building ASP .NET Web Applications |
The following example illustrates how to use the Style property to hide or display a Label control on a page.
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. |
Note: