System.Web.UI.WebControls.ButtonFieldBase Class

Serves as the abstract base class for button fields, such as the System.Web.UI.WebControls.ButtonField or System.Web.UI.WebControls.CommandField class. The System.Web.UI.WebControls.ButtonFieldBase class provides the methods and properties that are common to all button fields.

See Also: ButtonFieldBase Members

Syntax

public abstract class ButtonFieldBase : DataControlField

Remarks

The System.Web.UI.WebControls.ButtonFieldBase class is the abstract base class for button fields and contains the methods and properties that are common to all button fields. Because this class is abstract, you cannot create an instance of it directly. Instead, you must create an instance of a non-abstract class that inherits from the System.Web.UI.WebControls.ButtonFieldBase class, such as the System.Web.UI.WebControls.ButtonField or System.Web.UI.WebControls.CommandField class.

An object that is derived from the System.Web.UI.WebControls.ButtonFieldBase is used by data-bound controls (such as the System.Web.UI.WebControls.GridView and System.Web.UI.WebControls.DetailsView controls) to display one or more buttons for each record that is displayed. A button field is displayed differently depending on the data-bound control in which it is used. For example, the System.Web.UI.WebControls.GridView control displays a button field as a column, whereas the System.Web.UI.WebControls.DetailsView control displays it as a row.

Clicking a button in a button field raises the command event of the parent data-bound control. You can provide a custom routine to perform when a button is clicked by providing an event handler for the command event.

Note:

The System.Web.UI.WebControls.GridView control raises the GridView.RowCommand event, whereas the System.Web.UI.WebControls.DetailsView control raises the DetailsView.ItemCommand event.

To specify the type of button to display, use the ButtonFieldBase.ButtonType property. To show or hide the header section of a System.Web.UI.WebControls.ButtonFieldBase object, set the ButtonFieldBase.ShowHeader property.

Note:

Some data-bound controls (such as the System.Web.UI.WebControls.GridView control) can show or hide only the entire header section of the control. These data-bound controls do not support the ButtonFieldBase.ShowHeader property for an individual button field. To show or hide the entire header section of a data-bound control (if available), use the ShowHeader property for the control.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0