System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound Method

Calls the BaseDataBoundControl.DataBind method if the BaseDataBoundControl.DataSourceID property is set and the data-bound control is marked to require binding.

Syntax

protected virtual void EnsureDataBound ()

Remarks

The BaseDataBoundControl.EnsureDataBound method is called during the BaseDataBoundControl.OnPreRender(EventArgs) method, to call the BaseDataBoundControl.DataBind method if the data-bound control is not yet bound.

This is the same behavior pattern that the System.Web.UI.WebControls.BaseDataList (from which classes such as System.Web.UI.WebControls.DataGrid are derived) and System.Web.UI.WebControls.Repeater classes follow. The EnsureDataBound method might also be called during calls to CreateChildControls and LoadPostData methods.

Requirements

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