Getting dataset row from datagrid

  • Thread starter Thread starter Ron L
  • Start date Start date
R

Ron L

I have a grid that is the list portion of a list & detail set. I am
catching the SelectedIndexChanged event and using
dslistdata.Tables(0).Rows(grdListDisplay.CurrentRowIndex) to get the data
that fills the grid's row from the underlying dataset. This works fine if
the grid hasn't been sorted, but returns the wrong data if the grid has been
sorted. Is there a better way to get the underlying data from the dataset?
I have a number of columns in the dataset that I didn't include in the grid,
so I can't just use the data from the grid.

TIA
Ron L
 
Hi,

dslistdata.tables(0).defaultview.item(grdListDisplay.CurrentRowIndex)
will return a datarowview of that row.

Ken
--------------------
I have a grid that is the list portion of a list & detail set. I am
catching the SelectedIndexChanged event and using
dslistdata.Tables(0).Rows(grdListDisplay.CurrentRowIndex) to get the data
that fills the grid's row from the underlying dataset. This works fine if
the grid hasn't been sorted, but returns the wrong data if the grid has been
sorted. Is there a better way to get the underlying data from the dataset?
I have a number of columns in the dataset that I didn't include in the grid,
so I can't just use the data from the grid.

TIA
Ron L
 
Ken
Thanks for the suggestion. I tried that and found that it was giving me
a DataRowView when I needed a DataRow to pass along. What I ended up doing
was using the key for the table (which was a hidden column in the row) and
using it in the .Find method to get the correct row to pass along.

Thanks,
Ron L
 
Back
Top