See Also: GridViewRowEventArgs Members
Before the System.Web.UI.WebControls.GridView control can be rendered, a System.Web.UI.WebControls.GridViewRow object must be created for each row in the control. The GridView.RowCreated event is raised each time a row in the System.Web.UI.WebControls.GridView control is created. This allows you to provide an event-handling method that performs a custom routine, such as adding custom content to a row, whenever this event occurs.
Similarly, each row in the control must be bound to a record in the data source before the System.Web.UI.WebControls.GridView control can be rendered. 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 allows 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 allows you to access the properties of the row that raised the event. 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. You can also determine which row type (header row, data row, and so on) is being created by using the GridViewRow.RowType property of the System.Web.UI.WebControls.GridViewRow object.
For more information about handling events, see Consuming Events.