BaseDataBoundControl.EnsureDataBound Method

Definition

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

C#
protected virtual void EnsureDataBound();

Remarks

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

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

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also