Version

Index Property (RowAddingEventArgs)

Specifies the location in the collection at which to add the new row. You can set this property to a new value to change the location where the new row will get added.
Syntax
'Declaration
 
Public Property Index As Integer
public int Index {get; set;}
Example
Following code shows some of the information available in RowAdding and RowAdded events.

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_RowAdding(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinDataSource.RowAddingEventArgs) Handles UltraDataSource1.RowAdding
        ' RowAdding is fired when the user attempts to add a new row to the
        ' UltraDataSource through a bound control (like UltraGrid for example).
        ' Here you typically add a new row to the external data source if there is 
        ' one.

        Debug.WriteLine("Row is being added at " & e.Index _
            & " index in the rows collection associated with band " & e.Rows.Band.Key & ".")

    End Sub

    Private Sub UltraDataSource1_RowAdded(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinDataSource.RowAddedEventArgs) Handles UltraDataSource1.RowAdded
        ' Fired after RowAdding is fired.

        ' Row property returns the new row that was added.
        Debug.WriteLine("Row was added at " & e.Row.Index & " index.")

        ' You can initialize the new row's values here.
        Dim column As UltraDataColumn
        For Each column In e.Row.Band.Columns
            e.Row(column) = column.DefaultValue
        Next

    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinDataSource;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;


		private void ultraDataSource1_RowAdding(object sender, Infragistics.Win.UltraWinDataSource.RowAddingEventArgs e)
		{
			// RowAdding is fired when the user attempts to add a new row to the
			// UltraDataSource through a bound control (like UltraGrid for example).
			// Here you typically add a new row to the external data source if there is 
			// one.

			Debug.WriteLine( "Row is being added at " + e.Index 
				+ " index in the rows collection associated with band " + e.Rows.Band.Key + "." );
		}

		private void ultraDataSource1_RowAdded(object sender, Infragistics.Win.UltraWinDataSource.RowAddedEventArgs e)
		{
			// Fired after RowAdding is fired.

			// Row property returns the new row that was added.
			Debug.WriteLine( "Row was added at " + e.Row.Index + " index." );

			// You can initialize the new row's values here.
			foreach ( UltraDataColumn column in e.Row.Band.Columns )
				e.Row[ column ] = column.DefaultValue;
		}
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