GridView.CreateColumns(PagedDataSource, Boolean) 方法
定义
创建用来构建控件层次结构的列字段集。Creates the set of column fields used to build the control hierarchy.
protected:
virtual System::Collections::ICollection ^ CreateColumns(System::Web::UI::WebControls::PagedDataSource ^ dataSource, bool useDataSource);
protected virtual System.Collections.ICollection CreateColumns (System.Web.UI.WebControls.PagedDataSource dataSource, bool useDataSource);
abstract member CreateColumns : System.Web.UI.WebControls.PagedDataSource * bool -> System.Collections.ICollection
override this.CreateColumns : System.Web.UI.WebControls.PagedDataSource * bool -> System.Collections.ICollection
Protected Overridable Function CreateColumns (dataSource As PagedDataSource, useDataSource As Boolean) As ICollection
参数
- dataSource
- PagedDataSource
一个 PagedDataSource,表示数据源。A PagedDataSource that represents the data source.
- useDataSource
- Boolean
true 表示使用 dataSource 参数指定的数据源;否则为 false。true to use the data source specified by the dataSource parameter; otherwise, false.
返回
一个 ICollection,包含用来构建控件层次结构的字段。A ICollection that contains the fields used to build the control hierarchy.
注解
当 AutoGenerateColumns 属性设置为时,将为 true 数据源中的每个字段自动创建绑定列字段。When the AutoGenerateColumns property is set to true, a bound column field is automatically created for each field in the data source. 然后,每个绑定列字段在控件中显示为一行,并 GridView 按字段在数据源中的显示顺序显示。Each bound column field is then displayed as a row in the GridView control in the order that the fields appear in the data source. CreateColumns方法用于创建自动生成的列字段。The CreateColumns method is used to create the automatically generated column fields.
备注
此方法主要由控件开发人员用来扩展 GridView 控件。This method is used primarily by control developers to extend the GridView control.