Version

Index Property (UltraDataRow)

Index of this row in the parent collection.
Syntax
'Declaration
 
Public ReadOnly Property Index As Integer
public int Index {get;}
Example
Following code shows some of the information available in InitializeDataRow event and typical usage for it.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinDataSource
Imports Infragistics.Win.UltraWinGrid


    Private Sub UltraDataSource1_InitializeDataRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinDataSource.InitializeDataRowEventArgs) Handles UltraDataSource1.InitializeDataRow
        ' InitializeDataRow event is used for initializing rows. It gets fired for 
        ' each row in the data source when the row is created for the first time.

        Dim row As UltraDataRow = e.Row

        ' You can use the tag off the row to store some piece of data that
        ' aids you in identifying the row later on (for example in other 
        ' event handlers like CellDataRequested).
        row.Tag = New Object()

        ' You can get the row collection that contains the row using 
        ' ParentCollection property.
        Dim parentCollection As UltraDataRowsCollection = e.Row.ParentCollection

        ' You can get the row's index in the parent collection using
        ' Index property.
        Dim rowIndex As Integer = row.Index

        ' You can get the parent row of a row using ParentRow property.
        ' If row is a top-most row, ParentRow will be null.
        Dim parentRow As UltraDataRow = row.ParentRow

        ' You can also see which band the row is associated with.
        Dim rowBand As UltraDataBand = row.Band

        ' You can also intialize the cell values here.
        Dim column As UltraDataColumn
        For Each column In rowBand.Columns
            If GetType(String) Is column.DataType Then
                row(column) = "Test Data"
            End If
        Next

        ' Print out the row index and the band key.
        System.Diagnostics.Debug.WriteLine("Band key = " & e.Row.Band.Key & "Row Index = " & e.Row.Index)
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinDataSource;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;


		private void ultraDataSource1_InitializeDataRow(object sender, Infragistics.Win.UltraWinDataSource.InitializeDataRowEventArgs e)
		{
			// InitializeDataRow event is used for initializing rows. It gets fired for 
			// each row in the data source when the row is created for the first time.

			UltraDataRow row = e.Row;

			// You can use the tag off the row to store some piece of data that
			// aids you in identifying the row later on (for example in other 
			// event handlers like CellDataRequested).
			row.Tag = new object( );

			// You can get the row collection that contains the row using 
			// ParentCollection property.
			UltraDataRowsCollection parentCollection = e.Row.ParentCollection;

			// You can get the row's index in the parent collection using
			// Index property.
			int rowIndex = row.Index;

			// You can get the parent row of a row using ParentRow property.
			// If row is a top-most row, ParentRow will be null.
			UltraDataRow parentRow = row.ParentRow;

			// You can also see which band the row is associated with.
			UltraDataBand rowBand = row.Band;

			// You can also intialize the cell values here.
			foreach ( UltraDataColumn column in rowBand.Columns )
			{
				if ( typeof( string ) == column.DataType )
					row[ column ] = "Test Data";
			}

			// Print out the row index and the band key.
			System.Diagnostics.Debug.WriteLine( "Band key = " + e.Row.Band.Key + "Row Index = " + e.Row.Index );
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also