ButtonFieldBase 类

定义

用作按钮字段的抽象基类(如 ButtonFieldCommandField 类)。Serves as the abstract base class for button fields, such as the ButtonField or CommandField class. ButtonFieldBase 类提供由所有按钮字段公用的方法和属性。The ButtonFieldBase class provides the methods and properties that are common to all button fields.

public ref class ButtonFieldBase abstract : System::Web::UI::WebControls::DataControlField
public abstract class ButtonFieldBase : System.Web.UI.WebControls.DataControlField
type ButtonFieldBase = class
    inherit DataControlField
Public MustInherit Class ButtonFieldBase
Inherits DataControlField
继承
ButtonFieldBase
派生

注解

ButtonFieldBase类是按钮字段的抽象基类, 其中包含所有按钮字段共有的方法和属性。The 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. 相反, 您必须创建一个继承自ButtonFieldBase类的非抽象类的实例, 如ButtonFieldCommandField类。Instead, you must create an instance of a non-abstract class that inherits from the ButtonFieldBase class, such as the ButtonField or CommandField class.

数据绑定控件 (如ButtonFieldBase GridViewDetailsView控件) 使用派生的对象来显示每个显示的记录的一个或多个按钮。An object that is derived from the ButtonFieldBase is used by data-bound controls (such as the GridView and 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. 例如, GridView控件以列的形式显示按钮字段, DetailsView而控件则将其显示为一行。For example, the GridView control displays a button field as a column, whereas the 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.

备注

控件引发事件, 而DetailsView控件引发事件。ItemCommand RowCommand GridViewThe GridView control raises the RowCommand event, whereas the DetailsView control raises the ItemCommand event.

若要指定要显示的按钮类型, 请使用ButtonType属性。To specify the type of button to display, use the ButtonType property. 若要显示或隐藏ButtonFieldBase对象的标头部分, 请ShowHeader设置属性。To show or hide the header section of a ButtonFieldBase object, set the ShowHeader property.

备注

某些数据绑定控件 (如GridView控件) 只能显示或隐藏控件的整个标题部分。Some data-bound controls (such as the GridView control) can show or hide only the entire header section of the control. 这些数据绑定控件不支持单个按钮字段ShowHeader的属性。These data-bound controls do not support the ShowHeader property for an individual button field. 若要显示或隐藏数据绑定控件 (如果可用) 的整个标头部分, 请使用控件ShowHeader的属性。To show or hide the entire header section of a data-bound control (if available), use the ShowHeader property for the control.

实施者说明

ButtonFieldBase类继承时, 必须重写以下成员: CopyProperties(DataControlField)When you inherit from the ButtonFieldBase class, you must override the following member: CopyProperties(DataControlField).

构造函数

ButtonFieldBase()

初始化 ButtonFieldBase 类的新实例。Initializes a new instance of the ButtonFieldBase class.

属性

AccessibleHeaderText

获取或设置某些控件中呈现为 AbbreviatedText 属性值的文本。Gets or sets text that is rendered as the AbbreviatedText property value in some controls.

(继承自 DataControlField)
ButtonType

获取或设置要在按钮字段中显示的按钮类型。Gets or sets the button type to display in the button field.

CausesValidation

获取或设置一个值,该值指示在单击 ButtonFieldBase 对象中的按钮时是否执行验证。Gets or sets a value indicating whether validation is performed when a button in a ButtonFieldBase object is clicked.

Control

获取对数据控件的引用,该控件与 DataControlField 对象关联。Gets a reference to the data control that the DataControlField object is associated with.

(继承自 DataControlField)
ControlStyle

获取 DataControlField 对象所包含的任何 Web 服务器控件的样式。Gets the style of any Web server controls contained by the DataControlField object.

(继承自 DataControlField)
DesignMode

获取一个值,该值指示数据控件字段当前是否在设计时环境中进行查看。Gets a value indicating whether a data control field is currently viewed in a design-time environment.

(继承自 DataControlField)
FooterStyle

获取或设置数据控件字段脚注的样式。Gets or sets the style of the footer of the data control field.

(继承自 DataControlField)
FooterText

获取或设置数据控件字段的脚注项中显示的文本。Gets or sets the text that is displayed in the footer item of a data control field.

(继承自 DataControlField)
HeaderImageUrl

获取或设置数据控件字段的标题项中显示的图像的 URL。Gets or sets the URL of an image that is displayed in the header item of a data control field.

(继承自 DataControlField)
HeaderStyle

获取或设置数据控件字段标头的样式。Gets or sets the style of the header of the data control field.

(继承自 DataControlField)
HeaderText

获取或设置数据控件字段的标题项中显示的文本。Gets or sets the text that is displayed in the header item of a data control field.

(继承自 DataControlField)
InsertVisible

获取一个值,该值指示 DataControlField 对象在其父级数据绑定控件处于插入模式时是否可见。Gets a value indicating whether the DataControlField object is visible when its parent data-bound control is in insert mode.

(继承自 DataControlField)
IsTrackingViewState

获取一个值,该值指示 DataControlField 对象是否保存对其视图状态的更改。Gets a value indicating whether the DataControlField object is saving changes to its view state.

(继承自 DataControlField)
ItemStyle

获取由数据控件字段显示的任何基于文本的内容的样式。Gets the style of any text-based content displayed by a data control field.

(继承自 DataControlField)
ShowHeader

获取或设置一个值,该值指示是否显示 ButtonFieldBase 对象的标头部分。Gets or sets a value indicating whether the header section is displayed in a ButtonFieldBase object.

SortExpression

获取或设置数据源控件用来对数据进行排序的排序表达式。Gets or sets a sort expression that is used by a data source control to sort data.

(继承自 DataControlField)
ValidateRequestMode

获取或设置一个值,该值指定该控件是否验证客户端输入。Gets or sets a value that specifies whether the control validates client input.

(继承自 DataControlField)
ValidationGroup

获取或设置在单击 ButtonFieldBase 对象中的按钮时要验证的验证控件组的名称。Gets or sets the name of the group of validation controls to validate when a button in a ButtonFieldBase object is clicked.

ViewState

获取状态信息的字典,这些信息使您可以在同一页的多个请求间保存和还原 DataControlField 对象的视图状态。Gets a dictionary of state information that allows you to save and restore the view state of a DataControlField object across multiple requests for the same page.

(继承自 DataControlField)
Visible

获取或设置指示是否呈现数据控件字段的值。Gets or sets a value indicating whether a data control field is rendered.

(继承自 DataControlField)

方法

CloneField()

创建当前 DataControlField 派生对象的副本。Creates a duplicate copy of the current DataControlField-derived object.

(继承自 DataControlField)
CopyProperties(DataControlField)

将从 ButtonFieldBase 类派生的当前对象的属性复制到指定的 DataControlField 对象。Copies the properties of the current object that is derived from the ButtonFieldBase class to the specified DataControlField object.

CreateField()

当在派生类中重写时,创建一个空的 DataControlField 派生对象。When overridden in a derived class, creates an empty DataControlField-derived object.

(继承自 DataControlField)
Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
ExtractValuesFromCell(IOrderedDictionary, DataControlFieldCell, DataControlRowState, Boolean)

从当前表格单元格中提取数据控件字段的值,并将该值添加到指定的 IDictionary 集合中。Extracts the value of the data control field from the current table cell and adds the value to the specified IDictionary collection.

(继承自 DataControlField)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
Initialize(Boolean, Control)

为数据控件字段执行基础实例初始化。Performs basic instance initialization for a data control field.

(继承自 DataControlField)
InitializeCell(DataControlFieldCell, DataControlCellType, DataControlRowState, Int32)

将文本或控件添加到单元格的控件集合中。Adds text or controls to a cell's controls collection.

(继承自 DataControlField)
LoadViewState(Object)

将数据源视图还原为保存过的前一视图状态。Restores the data source view's previously saved view state.

(继承自 DataControlField)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
OnFieldChanged()

引发 FieldChanged 事件。Raises the FieldChanged event.

(继承自 DataControlField)
SaveViewState()

保存在页回发到服务器后对 DataControlField 视图状态所做的更改。Saves the changes made to the DataControlField view state since the time the page was posted back to the server.

(继承自 DataControlField)
ToString()

返回表示此 DataControlField 对象的字符串。Returns a string that represents this DataControlField object.

(继承自 DataControlField)
TrackViewState()

使 DataControlField 对象跟踪对其视图状态所做的更改,以便这些更改可以存储在控件的 ViewState 属性中并且能够在同一页的不同请求间得以保持。Causes the DataControlField object to track changes to its view state so they can be stored in the control's ViewState property and persisted across requests for the same page.

(继承自 DataControlField)
ValidateSupportsCallback()

当在派生类中重写时,发出信号表示字段所包含的控件支持回调。When overridden in a derived class, signals that the controls contained by a field support callbacks.

(继承自 DataControlField)

显式接口实现

IDataSourceViewSchemaAccessor.DataSourceViewSchema

获取或设置与此 DataControlField 对象关联的架构。Gets or sets the schema associated with this DataControlField object.

(继承自 DataControlField)
IStateManager.IsTrackingViewState

获取一个值,该值指示 DataControlField 对象是否保存对其视图状态的更改。Gets a value indicating whether the DataControlField object is saving changes to its view state.

(继承自 DataControlField)
IStateManager.LoadViewState(Object)

将数据控件字段还原为保存过的前一视图状态。Restores the data control field's previously saved view state.

(继承自 DataControlField)
IStateManager.SaveViewState()

保存在页回发到服务器后对 DataControlField 视图状态所做的更改。Saves the changes made to the DataControlField view state since the time the page was posted back to the server.

(继承自 DataControlField)
IStateManager.TrackViewState()

使 DataControlField 对象跟踪对其视图状态所做的更改,以便这些更改可以存储在控件的 ViewState 属性中并且能够在同一页的不同请求间得以保持。Causes the DataControlField object to track changes to its view state so they can be stored in the control's ViewState property and persisted across requests for the same page.

(继承自 DataControlField)

适用于

另请参阅