Home › Forums › WinForms controls › Xceed Grid for WinForms › Xceed grid bound to strongly typed dataset – how to access current row from the dataset?
Really basic question this. I need to access the strongly typed dataset row directly, rather than via gridControl1.CurrentCell.ParentRow. How do I cast it or otherwise access the bound data row?
Imported from legacy forums. Posted by Jeremy (had 1014 views)
If you are using dataview, you can get the current row by the databinding position or u can use
Dim selectedRow As Xceed.Grid.DataRow = CType(grid.CurrentRow, Xceed.Grid.DataRow) to get the selectedrow
Imported from legacy forums. Posted by Prabha (had 223 views)
Thanks, but I dont want a generic Xceed.Grid.DataRow, I want the strongly typed row in my bound dataset.
Imported from legacy forums. Posted by Jeremy (had 257 views)
Still no satisfactory answer to this. I thought it should be something very basic.
Imported from legacy forums. Posted by Jeremy (had 207 views)
Only way I found seems to be to make an assumption about what the grid is bound to, as in:
int rowIndex = ((Xceed.Grid.DataRow)gridControl1.CurrentRow).Index; MyStronglyTypedDataTableRow r = (MyStronglyTypedDataTableRow)myStronglyTypedDataSet.MyStronglyTypedDataTable.Rows[rowIndex]; r.MyColumn = 33;
But what if the grid is bound to a DataView and we apply different RowFilters? Can’t use the same. I’m surprised there’s no easy way to do this. What I want is something like:
MyStronglyTypedDataTableRow r =
which would work irrespective of whether the grid is bound to MyStronglyTypedDataTable or a DataView based upon it.
Imported from legacy forums. Posted by Jeremy (had 1021 views)