System.Web.UI.WebControls.BaseDataList.DataSource Property

Gets or sets the source containing a list of values used to populate the items within the control.

Syntax

[System.Web.UI.Themeable(false)]
[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
[System.ComponentModel.DefaultValue(null)]
[System.ComponentModel.Bindable(true)]
public virtual object DataSource { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

Use the BaseDataList.DataSource property to specify the source of values to bind to a data listing control. A data source must be a collection that implements either the IEnumerable interface (such as System.Data.DataView, ArrayList, or List`1) or the System.ComponentModel.IListSource interface to bind to a control derived from the System.Web.UI.WebControls.BaseDataList class. When you set the BaseDataList.DataSource property, you must manually write the code to perform data binding.

If the data source specified by the BaseDataList.DataSource property contains multiple sources of data, use the BaseDataList.DataMember property to specify the specific source to bind to the control. For example, if you have a System.Data.DataSet object with multiple tables, you must specify which table to bind to the control. After you have specified the data source, use the BaseDataList.DataBind method to bind the data source to the control.

Alternately, you can use the BaseDataList.DataSourceID property to automatically bind to a data source represented by a data source control. When you set the BaseDataList.DataSourceID property, the data listing control automatically binds to the specified data source control. You do not need to write code that explicitly calls the BaseDataList.DataBind method.

If values are specified for both the BaseDataList.DataSource property and the BaseDataList.DataSourceID property, ASP.NET is not able to resolve the data source and an System.Web.HttpException exception is thrown.

This property cannot be set by themes or style sheet themes. For more information, see System.Web.UI.ThemeableAttribute and ASP.NET Themes Overview.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0