DataControlField.ControlStyle Property


Gets the style of any Web server controls contained by the DataControlField object.

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

member ControlStyle : Style with get

Property Value

Type: System.Web.UI.WebControls.Style

A Style that governs the appearance of Web server controls contained by the field.

The ControlStyle property governs the appearance of any Web server controls contained by types derived from DataControlField.

This property does not affect all derived types. The BoundField control, which typically displays text data and contains only TextBox controls, is only affected by the ControlStyle property when in Edit state. Web server controls such as ButtonField and CheckBoxField might be affected by the ControlStyle property, depending on the specific configuration of the control object instances contained by the field. For example, the ButtonField control can be rendered as a LinkButton, ImageButton, or Button object. Although a LinkButton control is affected by font attributes of the specified Style object, a Button control is not.

The following code example demonstrates how to use BoundField and ButtonField objects, which are derived from DataControlField, to display rows in a DetailsView control. The ControlStyle property of the ButtonField object is set and governs how the LinkButton control contained by the field is displayed.

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

.NET Framework
Available since 2.0
Return to top