Export (0) Print
Expand All
Expand Minimize

GridView::Rows Property

Gets a collection of GridViewRow objects that represent the data rows in a GridView control.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

[BrowsableAttribute(false)]
public:
virtual property GridViewRowCollection^ Rows {
	GridViewRowCollection^ get ();
}

Property Value

Type: System.Web.UI.WebControls::GridViewRowCollection
A GridViewRowCollection that contains all the data rows in a GridView control.

The Rows property (collection) is used to store the data rows in a GridView control. The GridView control automatically populates the Rows collection by creating a GridViewRow object for each record in the data source and then adding each object to the collection. This property is commonly used to access a specific row in the control or to iterate though the entire collection of rows.

NoteNote

Only rows with their RowType property set to DataControlRowType.DataRow are stored in the Rows collection. The GridViewRow objects that represent the header, footer, and pager rows are not included in the collection.

The following example demonstrates how to use the Rows collection to access the row being edited in a GridView control. After a row is updated, a message is displayed to indicate that the update was successful.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft