System.Web.UI.WebControls.GridView.RowDataBound Event

Occurs when a data row is bound to data in a System.Web.UI.WebControls.GridView control.

Syntax

public event GridViewRowEventHandler RowDataBound

Remarks

Before the System.Web.UI.WebControls.GridView control can be rendered, each row in the control must be bound to a record in the data source. The GridView.RowDataBound event is raised when a data row (represented by a System.Web.UI.WebControls.GridViewRow object) is bound to data in the System.Web.UI.WebControls.GridView control. This enables you to provide an event-handling method that performs a custom routine, such as modifying the values of the data bound to the row, whenever this event occurs.

A System.Web.UI.WebControls.GridViewRowEventArgs object is passed to the event-handling method, which enables you to access the properties of the row being bound. To access a specific cell in the row, use the TableRow.Cells property of the System.Web.UI.WebControls.GridViewRow object contained in the GridViewRowEventArgs.Row property of the System.Web.UI.WebControls.GridViewRowEventArgs object. You can determine which row type (header row, data row, and so on) is being bound by using the GridViewRow.RowType property.

For more information about handling events, see Consuming Events.

Requirements

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