System.Web.UI.WebControls Namespace GridView Class
.NET Framework version 2.0
Occurs when a row is created in the GridView control.
[ VB ]
Public Event RowCreated As GridViewRowEventHandler
[ C# ]
public event GridViewRowEventHandler RowCreated;
[ C++ ]
public: __event GridViewRowEventHandler* RowCreated;
In [ JScript ], you can handle the events defined by a class, but you cannot define your own.
The GridView control is structurally composed of an assortment of rows. You can have up to seven different types of rows in a GridView: a data row, an empty data row, a header, a pager, a footer, the currently selected row, and the row that is currently being edited.
When any of these rows are created, the GridView control fires a RowCreated event, for which you can respond to with an appropriate handler.
This event provides an opportunity to access each row before the page is finally sent to the client for display. After this event is raised, the row is then bound to data and the RowDataBound event in turn is raised, after which the data row is nulled out and no longer available.
Information related to the RowCreated event is passed via a GridViewRowEventArgs object to the method assigned to handle the event. The following GridViewRowEventArgs property provides information specific to this event.
Property |
Description |
Row |
Gets the GridViewRow associated with the event. |
The below snippet shows how to attach a handler for the event.
<asp:gridview id = "myGridView" runat = "server"
onRowCreated = "setFooter" ... >
The following examples demonstrate how to code a handler for the RowCreated event of a GridView control in different scenarios.
GridView Members RowDataBound GridViewRowEventArgs