GridView.CreateChildControls(IEnumerable, Boolean) 方法

定義

使用特定資料來源建立用於呈現 GridView 控制項的控制階層架構。

protected:
 override int CreateChildControls(System::Collections::IEnumerable ^ dataSource, bool dataBinding);
protected override int CreateChildControls (System.Collections.IEnumerable dataSource, bool dataBinding);
override this.CreateChildControls : System.Collections.IEnumerable * bool -> int
Protected Overrides Function CreateChildControls (dataSource As IEnumerable, dataBinding As Boolean) As Integer

參數

dataSource
IEnumerable

IEnumerable,包含 GridView 控制項的資料來源。

dataBinding
Boolean

true 指示子控制項繫結至資料,否則為 false

傳回

Int32

建立的資料列數目。

例外狀況

dataSource 會傳回 null DataSourceView

-或- dataSource 不會實作 ICollection 介面,且無法傳回 TotalRowCount

-或- AllowPagingtrue,而 dataSource 不會實作 ICollection 介面且無法執行資料來源分頁。

-或- dataSource 不會實作 ICollection 介面,且 dataBinding 設為 false

備註

方法 CreateChildControls 可用來建立控制項的 GridView 控制項階層。

注意

這個方法主要是由控制項開發人員用來擴充 GridView 控制項。

適用於

另請參閱