Version

AfterRowInsert Event

Occurs after a new row is inserted.
Syntax
'Declaration
 
Public Event AfterRowInsert As RowEventHandler
public event RowEventHandler AfterRowInsert
Event Data

The event handler receives an argument of type RowEventArgs containing data related to this event. The following RowEventArgs properties provide information specific to this event.

PropertyDescription
Row The row (usually the row that the cell belongs to) (read-only)
Remarks

Therowargument returns a reference to an UltraGridRow object that can be used to set properties of, and invoke methods on, the row that was inserted. You can use this reference to access any of the returned row's properties or methods.

This event is generated after a new row has been inserted, either programmatically, or by user interaction. A new row can be inserted programmatically by invoking theAddNewmethod.

Note that the new row is not necessarily committed to the data source at the time of insert, however, since various factors such as the type of record locking employed by the data source, as well as the value of theUpdateModeproperty, can affect when the actual update occurs.

TheBeforeRowInsertevent, which occurs before a row is inserted, is generated before this event.

Example
Following code shows some of the information available in AfterRowInsert event. It sets the default value of a cell in the new row that has just been added. It only does that to the rows that are added to the 3rd band.

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.UltraWinGrid

  Private Sub UltraGrid1_AfterRowInsert(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.RowEventArgs) Handles ultraGrid1.AfterRowInsert

      ' If the row was added to the 3rd band
      If e.Row.Band Is Me.ultraGrid1.DisplayLayout.Bands(2) Then
          ' Set a default value for OrderDate column to today's date.
          e.Row.Cells("OrderDate").Value = DateTime.Now
      End If

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

private void ultraGrid1_AfterRowInsert(object sender, Infragistics.Win.UltraWinGrid.RowEventArgs e)
{

	// If the row was added to the 3rd band
	if ( e.Row.Band == this.ultraGrid1.DisplayLayout.Bands[2] )
	{
		// Set a default value for OrderDate column to today's date.
		e.Row.Cells["OrderDate"].Value = DateTime.Now;
	}

}
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