BaseDataBoundControl::DataSource Property

 

Gets or sets the object from which the data-bound control retrieves its list of data items.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public:
[BindableAttribute(true)]
[ThemeableAttribute(false)]
property Object^ DataSource {
	virtual Object^ get();
	virtual void set(Object^ value);
}

Property Value

Type: System::Object^

An object that represents the data source from which the data-bound control retrieves its data. The default is null.

When you set the DataSource property, 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.

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

The following code example demonstrates how the DataSource property of a data-bound control is used. In this example, the GridView control is bound to a DataSet object. After the DataSource property is set, the DataBind method is called explicitly.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: