asp.net.ph

BaseDataBoundControl.DataSource Property

System.Web.UI.WebControls Namespace   BaseDataBoundControl Class


Sets or retrieves the source from which a data-bound control retrieves its list of data items.

Syntax


Inline <asp:basedataboundcontrol datasource = enumerable ... >
Script BaseDataBoundControl.DataSource [ = enumerable ]

Property Value


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.

Remarks

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.

Example

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.

GridView RowCreated, RowDataBound Events Example
Run Sample | View Source
GridView ImageField Example
Run Sample | View Source
Binding a BulletedList to a Data Source Control
Run Sample | View Source

For more information, see DataBinding in Web Forms.

See Also

BaseDataBoundControl Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph