Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Initialize Method

ButtonField.Initialize Method

Initializes the current ButtonField object.

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

public override bool Initialize(
	bool sortingEnabled,
	Control control


Type: System.Boolean

true to enable sorting; otherwise, false.

Type: System.Web.UI.Control

The data control that owns the ButtonField.

Return Value

Type: System.Boolean
false, which indicates the control does not need to rebind to the data.

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. 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.

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. 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.

Notes to Inheritors

You should override the Initialize method and return true, if the field requires that data binding be performed on postback in order for the field to work correctly.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0
© 2015 Microsoft