Excuse me if I'm using the incorrect terms as this Infragistics stuff is new to me.
The Groups are declared as GroupID, and the Users are declared as UserID. The bold portion of the code works, but only for the first group. It's grabbing a value from a textbox (popup) and comparing it to what I have on the grid.
I think it's best illustrated here:
Group 1
Group 2
I've done it manually so far:
GridRowType rowTypes = GridRowType.DataRow;UltraGridBand band = frm.ultraGridUsers.DisplayLayout.Bands[1];IEnumerable enumerator = band.GetRowEnumerator(rowTypes);foreach (UltraGridRow row in enumerator){if ((ultraTextEditorUnit.Text == row.Cells["UnitID"].Text) && (ultraTextEditorGroupAlias.Text == frm.ultraGridUsers.DisplayLayout.Rows[0].Cells["Alias"].Text)) { MessageBox.Show(this, "Duplicate UnitID", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.ultraTextEditorUnit.Focus(); allowClose = false; } else allowClose = true; }
Hi,
It's hard to tell from this screen shot, but it does not appear to me that you are using any grouping functionality in this grid. It looks like you just have 2 bands - which explains why your original code doesn't blow up when you try to access the cells collection of the first row.
So basically, all you have to do here is loop through the child rows collection under each parent row.
Are you trying to validate all of the child rows in the entire grid? Or just one set of child rows to which the new row you just added belongs?
By using the GetRowsEnumerator like you are doing, you are looping through every child row in the whole grid. But that doesn't really make sense, since it's okay to have the same value in the child row as long as it's under a different parent row.
Mike Saltzman said:It's hard to tell from this screen shot, but it does not appear to me that you are using any grouping functionality in this grid. It looks like you just have 2 bands
Do I have to set something in the Designer Dialog in order to enable this?
Mike Saltzman said:Are you trying to validate all of the child rows in the entire grid? Or just one set of child rows to which the new row you just added belongs?
One set of child rows, not the entire grid.
Mike Saltzman said:So basically, all you have to do here is loop through the child rows collection under each parent row.
How do I do this without the Enumerator? Is it possible to do it with a foreach for each parent? I think the bands[0] takes the top-most parent.
Again, I apologize as I'm not familiar with the terminology of the "bands" and what not.
Thank you.
It looks like what you have here is a grid bound to a hierarchical data source. You are probably binding the grid to a DataSet with two tables and a Relationship defined between the two. The term 'band' refers to a particular level in the hierarchy of the data. So you have two bands.
If you have access to the grid row that you are validating, then getting the collection of rows to which that row belongs is very simple.
foreach (UltraGridRow siblingRow in row.ParentCollection) { if (row == siblingRow) continue; // Validate here }
foreach (UltraGridRow siblingRow in row.ParentCollection)
{
if (row == siblingRow)
continue;
// Validate here
}