System.Web.UI.WebControls Namespace BaseDataBoundControl Class
Sets or retrieves the source from which a data-bound control retrieves its list of data items.
Inline |
<asp:basedataboundcontrol datasource = enumerable ... > |
Script |
BaseDataBoundControl.DataSource [ = enumerable ] |
enumerable |
An object that represents the data source from which a data-bound control retrieves its data. |
The property is read/write with no default value.
Use the DataSource property to specify a source of data to populate a data control.
NOTE: The data source must be an object that implements the IEnumerable, IListSource, IDataSource, or IHierarchicalDatasource interface.
When the DataSource property is set, the ValidateDataSource method is called. In addition, if the data-bound control has already been initialized, the OnDataPropertyChanged method is called to set the RequiresDataBinding property to true.
The following examples demonstrate using the DataSource property in different scenarios, to specify the source from which a data-bound control retrieves its list of data items.
For more information, see DataBinding in Web Forms.
BaseDataBoundControl Members