Version

Rows Property (UltraGridChildBand)

The collection of child rows.
Syntax
'Declaration
 
Public ReadOnly Property Rows As RowsCollection
public RowsCollection Rows {get;}
Example
Following code shows you how to traverse through all the rows in the UltraGrid. It finds out the number of regular rows (non-group-by rows) and number of group-by rows and shows the counts.

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

  Private Sub Button40_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button40.Click

      Dim rowsCount As Integer = 0
      Dim groupByRowsCount As Integer = 0

      ' Call the helper method which is a recursive implmentation for traversing rows.
      MessageBox.Show("Please wait. This operation may take a while depending on number of rows.")
      Me.TraverseAllRowsHelper(Me.ultraGrid1.Rows, rowsCount, groupByRowsCount)

      ' Show a dialog showing the number of regular rows and number of group-by rows.
      MessageBox.Show("The UltraGrid has " & rowsCount & " number of regular rows, and " & groupByRowsCount & " number of group-by rows.")

  End Sub

  Private Sub TraverseAllRowsHelper(ByVal rows As RowsCollection, ByRef rowsCount As Integer, ByRef groupByRowsCount As Integer)

      ' Loop through every row in the passed in rows collection.
      Dim row As UltraGridRow = Nothing
      For Each row In rows

          ' If you are using Outlook GroupBy feature and have grouped rows by columns in the
          ' UltraGrid, then rows collection can contain group-by rows or regular rows. So you 
          ' may need to have code to handle group-by rows as well.
          If TypeOf row Is UltraGridGroupByRow Then
              Dim groupByRow As UltraGridGroupByRow = DirectCast(row, UltraGridGroupByRow)
              ' Incremement the group-by row count.
              groupByRowsCount += 1
          Else
              ' Incremenent the regular row count.
              rowsCount += 1
          End If

          ' If the row has any child rows. Typically, there is only a single child band. However,
          ' there will be multiple child bands if the band associated with row1 has mupliple child
          ' bands. This would be the case for exmple when you have a database hierarchy in which a
          ' table has multiple child tables.
          If Not Nothing Is row.ChildBands Then

              ' Loop throgh each of the child bands.
              Dim childBand As UltraGridChildBand = Nothing
              For Each childBand In row.ChildBands
                  ' Call this method recursivedly for each child rows collection.
                  Me.TraverseAllRowsHelper(childBand.Rows, rowsCount, groupByRowsCount)
              Next
          End If

      Next

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

private void button40_Click(object sender, System.EventArgs e)
{

	int rowsCount = 0;
	int groupByRowsCount = 0;

	// Call the helper method which is a recursive implmentation for traversing rows.
	MessageBox.Show( "Please wait. This operation may take a while depending on number of rows." );
	this.TraverseAllRowsHelper( this.ultraGrid1.Rows, ref rowsCount, ref groupByRowsCount );

	// Show a dialog showing the number of regular rows and number of group-by rows.
	MessageBox.Show( "The UltraGrid has " + rowsCount + " number of regular rows, and " + groupByRowsCount + " number of group-by rows." );

}
		
private void TraverseAllRowsHelper( RowsCollection rows, ref int rowsCount, ref int groupByRowsCount )
{

	// Loop through every row in the passed in rows collection.
	foreach ( UltraGridRow row in rows )
	{
		// If you are using Outlook GroupBy feature and have grouped rows by columns in the
		// UltraGrid, then rows collection can contain group-by rows or regular rows. So you 
		// may need to have code to handle group-by rows as well.
		if ( row is UltraGridGroupByRow )
		{
			UltraGridGroupByRow groupByRow = (UltraGridGroupByRow)row;

			// Incremement the group-by row count.
			groupByRowsCount++;
		}
		else					
		{
			// Incremenent the regular row count.
			rowsCount++;
		}
		
		// If the row has any child rows. Typically, there is only a single child band. However,
		// there will be multiple child bands if the band associated with row1 has mupliple child
		// bands. This would be the case for exmple when you have a database hierarchy in which a
		// table has multiple child tables.
		if ( null != row.ChildBands )
		{
			// Loop throgh each of the child bands.
			foreach ( UltraGridChildBand childBand in row.ChildBands )
			{
				// Call this method recursivedly for each child rows collection.
				this.TraverseAllRowsHelper( childBand.Rows, ref rowsCount, ref groupByRowsCount );
			}
		}
	}

}
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