B
Bajgon
Hello,
I have got a DataGrid and a DataTable, which is its DataSource.
I can use DataTable.Rows.Find(key_value) method to locate any row
in the DataTable, using values of key column. The result is a DataRow
object.
How to find and select the current position of this DataRow in
the DataGrid control?
I can use the DataTable.DefaultView.Find(key_value) method,
but there are some restrictions:
1. The key column must be present on the View - I'd rather
have it hidden.
2. The DataGrid needs to be sorted by the key column - I'd rather
not to change the sort order.
3. If the keys are not unique, the method returns first available,
which is not the best idea at all.
So, finding the DataRow on the underlying DataTable is nicer, but
how to map the row back onto the DataGrid?
I have got a DataGrid and a DataTable, which is its DataSource.
I can use DataTable.Rows.Find(key_value) method to locate any row
in the DataTable, using values of key column. The result is a DataRow
object.
How to find and select the current position of this DataRow in
the DataGrid control?
I can use the DataTable.DefaultView.Find(key_value) method,
but there are some restrictions:
1. The key column must be present on the View - I'd rather
have it hidden.
2. The DataGrid needs to be sorted by the key column - I'd rather
not to change the sort order.
3. If the keys are not unique, the method returns first available,
which is not the best idea at all.
So, finding the DataRow on the underlying DataTable is nicer, but
how to map the row back onto the DataGrid?