System.Web.UI Namespace Control Class
Binds a data source to the invoked server control and all of its child controls.
[ Visual Basic ]
Overridable Public Sub DataBind ( )
[ C# ]
public virtual void DataBind ( );
[ C++ ]
public: virtual void DataBind ( );
[ JScript ]
public function DataBind ( );
Use this method to bind data from a source to a server control.
When called on a server control, this method resolves all data-binding expressions in the server control and in any of its child controls.
This method is commonly used after retrieving a data set through a database query.
The DataBound event is raised whenever a BaseDataBoundControl is bound to data.
This event provides an opportunity to access each row in the BaseDataBoundControl before the page is finally sent to the client for display. After this event is raised, the data item is nulled out and no longer available.
The following examples demonstrate using the DataBind method in different scenarios, to bind the source from which a data-bound control retrieves its list of data items.
For more information, see DataBinding in Web Forms.
Control Members