We have a RadGridView with 2 columns.
When we edit a cell or when we are adding a new row, we want to loop through the rows cell[1] to check for duplicates.
We want to do this in...
private void TheGridCellValidating(object sender, GridViewCellValidatingEventArgs e).
We try things like this...
var grid = (e.Row).GridViewDataControl;
string value = e.NewValue.ToString();
var rows = grid.ChildrenOfType<GridViewRow>();
foreach (var row in rows)
{
if (row == null) continue;
if (row.Cells == null) continue;
if (row.Cells[1] != null)
{
var s = row.Cells[0]......
...
....
}
}
But... it won't work.
How can we iterate on the rows and check for duplicates?