Hello,
after I refresh my grid (resetting datasource and putting the new oen), I want to preserve the row selection.
How can i find a particular row from the datasource and make it the activerow,
tx
Marc
<<< The LINQ approach works like a charm. >>>
Only if the grid is not grouped.
As far as I could tell the LINQ approach only works if the grid isn't grouped. There doesn't appear to be a method to get a list of all the UltraGridRow objects in a single query that I could figure out, that would work for a grouped grid.
Any reason why Infragistics couldn't provide a list of all of the UltraGridRow objects corresponding to all the rows in the data source? We are all having to reinvent the wheel by writing code to iterate throught the collection to get this information which is a common requirement for all of us - it sure would be nice if this was a standard method or property of the grid.
Nice, emz. The LINQ approach works like a charm.
Thanks!
how about using Filter? can't we just set the filter option using .equal to our find strings, then we would be able to know whether the strings exist or not?
Mike, marcjannes, fergal1982
I have this same requirement in my project.
The .Find() method is a new LINQ extension for collections. However, because the .All property doesn't know that the items inside the RowsCollection object (UltraGrid1.Rows) are UltraGridRow objects, what seems to be syntactically correct is something like this ...
// get the row from the grid which represents the column for which the filter was modified. UltraGridRow colRow = this.ActiveGrid.Rows.OfType<UltraGridRow>().ToList().Find(row => row.Cells[0].Text.Equals(valueListColumnFiltersChangedEventArgs.Column.Name, StringComparison.CurrentCultureIgnoreCase));
Um, I don't think so. I could be wrong, but I am pretty sure that the All property is a property on Collection and it just returns an Object array. I wasn't aware that there was a Find method on an Array, but even if there is, I assume it finds some object that you specify. I don't see how it would be able to find an UltraGridRow with a cell that has a particular value. It knows nothing about the grid or cells.