asp.net.ph

GridView.RowCreated Event

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.

Remarks

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.

Event Data

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.

Example

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.

ButtonField ButtonType Example
Run Sample | View Source
GridView RowCreated Event Example
Run Sample | View Source
See Also

GridView Members   RowDataBound   GridViewRowEventArgs 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