asp.net.ph

DataGridItem.DataSetIndex Property

System.Web.UI.WebControls Namespace   DataGridItem Class


Returns the row index of the data bound to the DataGridItem.

Syntax


Script [ integer variable = ] DataGridItem.DataSetIndex

Property Value


variable The index number of the row from the data source bound to the DataGridItem.

The property is read only with no default value.

Remarks

Use the DataSetIndex property to determine the index number of the record in the data source bound to the DataGridItem object.

NOTE: This property only applies to data items in the DataGrid control. The ItemType property must be set to ListItemType.Item, ListItemType.AlternatingItem, ListItemType.SelectedItem, or ListItemType.EditItem.

Example

The following example demonstrates how to use the DataSetIndex property to retrieve and display the index number of the record in the data source bound to each DataGridItem.

void getItems ( Object src, EventArgs e ) {

   foreach ( DataGridItem item in myGrid.Items ) {
      msg.Text += "<br>" + item.DataSetIndex +
         " ~ " + item.Cells [ 0 ].Text + " " + item.Cells [ 1 ].Text;
   }
}
  C# VB

 Show me 

See Also

DataGridItem Members 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