Home Forums WinForms controls Xceed Grid for WinForms Xceed grid bound to strongly typed dataset – how to access current row from the dataset?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #17273 |

    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)

    User (Old forums)
    Member
    Post count: 23064

    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)

    User (Old forums)
    Member
    Post count: 23064

    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)

    User (Old forums)
    Member
    Post count: 23064

    Still no satisfactory answer to this. I thought it should be something very basic.

    Imported from legacy forums. Posted by Jeremy (had 207 views)

    User (Old forums)
    Member
    Post count: 23064

    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 =
    (MyStronglyTypedDataTableRow)dataGrid1.CurrentRow;

    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)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.