ButtonField.Initialize(Boolean, Control) 方法
定义
初始化当前的 ButtonField 对象。Initializes the current ButtonField object.
public:
override bool Initialize(bool sortingEnabled, System::Web::UI::Control ^ control);
public override bool Initialize (bool sortingEnabled, System.Web.UI.Control control);
override this.Initialize : bool * System.Web.UI.Control -> bool
Public Overrides Function Initialize (sortingEnabled As Boolean, control As Control) As Boolean
参数
- sortingEnabled
- Boolean
如果启用排序,则为 true;否则为 false。true to enable sorting; otherwise, false.
- control
- Control
拥有 ButtonField 的数据控件。The data control that owns the ButtonField.
返回
false,指示控件无需重新绑定到数据。false, which indicates the control does not need to rebind to the data.
注解
此 Initialize 方法由与对象关联的数据控件调用 ButtonField ,以便为该字段的实例执行基本对象初始化,然后将该字段添加到行集合中。The Initialize method is called by the data control with which the ButtonField object is associated to perform basic object initialization for instances of the field, before the field is ever added to a rows collection. 数据控件(如 DetailsView 和 GridView ) Initialize 在 CreateChildControls 调用其他方法(例如)之前调用方法中的方法, CreateRow 以创建包含数据的特定行。Data controls, such as DetailsView and GridView, call the Initialize method in their CreateChildControls methods before other methods, such as CreateRow, are called to create specific rows with data.
Initialize编写使用 TableCell 对象来执行对象的基本初始化的自定义数据绑定控件时,请调用方法 ButtonField 。Call The Initialize method when you are writing a custom data-bound control that uses TableCell objects to perform basic initialization for a ButtonField object. 如果 ButtonField 派生的类型在 TableCell 用方法中的数据或控件填充对象之前需要初始化对象,则实现此方法 InitializeCell 。Implement this method if your ButtonField-derived type requires any object initialization before it populates TableCell objects with data or controls in the InitializeCell method.
继承者说明
Initialize(Boolean, Control) true 如果字段要求在回发时执行数据绑定,则应重写方法并返回,以便字段可以正常工作。You should override the Initialize(Boolean, Control) method and return true, if the field requires that data binding be performed on postback in order for the field to work correctly.