Version

InitializeRow Event (UltraCombo)

Occurs when a row is initialized.
Syntax
'Declaration
 
Public Event InitializeRow As InitializeRowEventHandler
public event InitializeRowEventHandler InitializeRow
Event Data

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

PropertyDescription
ReInitialize True if the row has already been initialized (read-only)
Row The row being initialized (read-only)
Remarks

The InitializeRowEventArgs.Row argument returns a reference to an UltraGridRow object that can be used to set properties of, and invoke methods on, the row being displayed. You can use this reference to access any of the returned row's properties or methods.

The InitializeRowEventArgs.ReInitialize argument can be used to determine if the row is being initialized for the first time, such as when the UltraDropDown is initially loading data, or whether it is being reinitialized, such as when the RowsCollection.Refresh method is called.

This event is generated once for each row being displayed or printed and provides an opportunity to perform actions on the row before it is rendered, such as populating an unbound cell or changing a cell's color based on its value.

The UltraGridLayout.ViewStyle and UltraGridLayout.ViewStyleBand properties of the UltraGridBase.DisplayLayout object are read-only in this event procedure.

Example
Following code highlights rows that have UnitsInStock field value of 0 or less with red color.

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 UltraCombo1_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles ultraCombo1.InitializeRow

      ' IntializeRow gets fired for every row when the UltraCombo loads all the rows
      ' from the data source. It also fires it subsequently any time the data in the
      ' row changes. Following code hightlights all the rows in red that have 0 UnitsInStock.

      If e.Row.Cells("UnitsInStock").Value Is DBNull.Value OrElse Convert.ToInt32(e.Row.Cells("UnitsInStock").Value) <= 0 Then
          e.Row.Appearance.BackColor = Color.Red
      Else
          e.Row.Appearance.Reset()
      End If

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

private void ultraCombo1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{

	// IntializeRow gets fired for every row when the UltraCombo loads all the rows
	// from the data source. It also fires it subsequently any time the data in the
	// row changes. Following code hightlights all the rows in red that have 0 UnitsInStock.
	
	if ( e.Row.Cells["UnitsInStock"].Value is DBNull || Convert.ToInt32( e.Row.Cells["UnitsInStock"].Value ) <= 0 )
	{
		e.Row.Appearance.BackColor = Color.Red;
	}
	else
	{
		e.Row.Appearance.Reset( );
	}

}
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