BoundField.Initialize(Boolean, Control) 方法

定義

初始化 BoundField 物件。

public:
 override bool Initialize(bool enableSorting, System::Web::UI::Control ^ control);
public override bool Initialize (bool enableSorting, System.Web.UI.Control control);
override this.Initialize : bool * System.Web.UI.Control -> bool
Public Overrides Function Initialize (enableSorting As Boolean, control As Control) As Boolean

參數

enableSorting
Boolean

如果支援排序,則為 true,否則為 false

control
Control

擁有 BoundField 的資料控制項。

傳回

Boolean

所有情況下都是 false

備註

Initialize 欄位加入資料列集合之前,資料控制項 BoundField 會呼叫 與 物件相關聯的 物件,以執列欄位實例的基本物件初始化。 等 DetailsView 資料控制項會在 GridView 呼叫 這類的其他方法 CreateRow 之前,在其 方法中 CreateChildControls 呼叫 Initialize 方法,以建立具有資料的特定資料列。

當您撰寫自訂資料繫結控制項,以使用 TableCell 物件執行物件的基本初始化 BoundField 時,請呼叫這個方法。 如果您的 BoundField 衍生型別需要任何物件初始化,再將 方法中的資料 InitializeCell 或控制項填入 TableCell 物件,請實作這個方法。

適用於

另請參閱