asp.net.ph

Control.DataBind Method

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 ( );

Remarks

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.

Example

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.

GridView RowCreated, RowDataBound Events Example
Run Sample | View Source
GridView ImageField Example
Run Sample | View Source
Binding a BulletedList to a Data Source Control
Run Sample | View Source

For more information, see DataBinding in Web Forms.

See Also

Control Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph