System.Web.UI.WebControls.BaseDataBoundControl.DataBind Method

Binds a data source to the invoked server control and all its child controls.

Syntax

public override void DataBind ()

Remarks

The System.Web.UI.WebControls.BaseDataBoundControl class overrides the BaseDataBoundControl.DataBind method to identify the data source that the data-bound control binds to and builds the appropriate control trees. When resolving the data source, the data source identified by the BaseDataBoundControl.DataSourceID property takes precedence. If BaseDataBoundControl.DataSourceID is not set, the object identified by the BaseDataBoundControl.DataSource property is used.

The DataBind method is sealed on all ASP.NET data-bound controls derived from System.Web.UI.WebControls.BaseDataBoundControl. Data-bound controls derived from the System.Web.UI.WebControls.DataBoundControl and System.Web.UI.WebControls.HierarchicalDataBoundControl classes should override the PerformDataBinding method instead of the BaseDataBoundControl.DataBind method to bind data. If BaseDataBoundControl.DataBind is overridden, the System.Web.UI.Control.OnDataBinding(EventArgs) and BaseDataBoundControl.OnDataBound(EventArgs) events are raised out of order.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0