Version

Rows Property (UltraGridBase)

Returns a collection of the topmost level of rows in the grid. This collection will either contain all the rows in Band 0 or the top level of GroupBy rows (if GroupBy rows are being used.) This property is read-only at run-time and is not available at design-time.
Syntax
'Declaration
 
Public ReadOnly Property Rows As RowsCollection
public RowsCollection Rows {get;}
Remarks

The Rows collection provides a easy way to navigate through row hierarchy of the grid, determine whether the grid contains data, and determine how rows are being displayed in GroupBy mode. When displaying data in a standard hierarchical view, the Rows collection contains an UltraGridRow object for every top-level (Band 0) row in the grid. The UltraGridRow objects in the collection expose a ChildBands property, which returns a collection of Rows collections representing the rows of the bands which are children of the current row.

The Rows colelction is also useful in GroupBy mode, when the top-level band or bands of the grid may consist of virtual "group by" rows. In this case, you use the Rows collection to obtain all the GroupBy rows that are being displayed, and the ChildBand properties of those rows provide a way to drill down to the actual data.

Example
Rows property off the UltraGrid returns a RowsCollection. This RowsCollection contains the top level rows as its elements. They can be instances of UltraGridRow or UltraGridGroupByRow if you have group-by rows in band 0. Using this collection, you can traverse down the rows hierarchy. Following code loops throgh the top level rows and prints out the number of child records each row has.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics

   Private Sub Button23_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button23.Click

       ' Loop throgh the rows.
       Dim i As Integer
       For i = 0 To Me.ultraGrid1.Rows.Count - 1
           If TypeOf Me.ultraGrid1.Rows(i) Is UltraGridGroupByRow Then
               ' If the row is a group-by row, then print out the number of child rows it has.
               Dim groupByRow As UltraGridGroupByRow = DirectCast(Me.ultraGrid1.Rows(i), UltraGridGroupByRow)
               Debug.WriteLine(groupByRow.Value.ToString() & " has " & groupByRow.Rows.Count.ToString() & " number of child rows.")
           Else
               ' If the row is a regular row, then print out the number of child rows it has
               ' in "CustomerOrders" child band.
               Dim row As UltraGridRow = Me.ultraGrid1.Rows(i)
               Debug.WriteLine(row.Cells("CustomerID").Text & " has " & row.ChildBands("CustomersOrders").Rows.Count.ToString() & " number of child rows.")
           End If
       Next

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

private void button23_Click(object sender, System.EventArgs e)
{
	// Loop throgh the rows.
	for ( int i = 0; i < this.ultraGrid1.Rows.Count; i++ )
	{
		if ( this.ultraGrid1.Rows[i] is UltraGridGroupByRow )
		{
			// If the row is a group-by row, then print out the number of child rows it has.
			UltraGridGroupByRow groupByRow = (UltraGridGroupByRow)this.ultraGrid1.Rows[i];

			Debug.WriteLine( groupByRow.Value.ToString( ) + " has " +
				groupByRow.Rows.Count.ToString( ) + " number of child rows." );
		}
		else
		{
			// If the row is a regular row, then print out the number of child rows it has
			// in "CustomersOrders" child band.

			UltraGridRow row = this.ultraGrid1.Rows[i];

			Debug.WriteLine( row.Cells["CustomerID"].Text + " has " +
				row.ChildBands["CustomersOrders"].Rows.Count.ToString( ) + " number of child rows." );
		}
	}
}
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