asp.net.ph

DataRowCollection.Item Property

System.Data Namespace   DataRowCollection Class


Returns a row at the specified index.

Syntax


DataRow variable = DataRowCollection.Item [ rowIndex ];
... or ...
DataRow variable = DataRowCollection [ rowIndex ];
  C# VB JScript

Parameters

rowIndex
The zero-based index of the row to return.

Property Value

The specified DataRow.

Exceptions


Exception Type Condition
IndexOutOfRangeException Occurs when the index value is greater than the number of items in the collection.

Remarks

Use this indexer to get a DataRow object from the DataRowCollection at the specified index using array notation.

Example

The below snippet shows how to use the Item property to programmatically set the index of the DataRow to access, based on the selected item in a templated control.

DataRow myRow = myTable.Rows [ .Item.ItemIndex ];
  C# VB

The following examples demonstrate use of the Item property to return the row at the specified index in a DataRowCollection.

DataGrid EditItemIndex Property
Run Sample | View Source
Using a DropDownList in Editable DataList
Run Sample | View Source
Editing Items with Validation in DataList
Run Sample | View Source

See Also

DataRowCollection Members   Contains Skip Navigation Links




Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note