I have an ultragrid with two bands. Band 0 and Band 1. How to loop only through the parent rows i.e only through the band 0 and find the cell value in that band 0 so that I can compare that value ? Am using the InitializeRow Event.
Hi,
If you are using InitializeRow, then you could check the e.Row.Band and look at the Key or the Index of the band to determine if you are dealing with the Band 0 rows.
If you want to loop through the grid rows outside of InitializeRow, then you would do something like this:
foreach (UltraGridRow row in this.ultraGrid1.Rows)
{
if (row.Cells[0].Value == theValueIAmLookingFor)
// do something
}
Yes I want to use the InitializeRow Event.
This is my code:
if( e.Row.Band.Index == 0)
UltraGridBand band = this.ultragrid1.DisplayLayout.Bands[0];
foreach(UltraGridRow row in band.GetEnumerator(GridRowType.DataRow))
if(e.Row.Cells["Key"].Value.Equals("Value am looking for"))
//Do something...
But this loops through all the rows including the child rows. Can i modify this to loop only the parent rows??