DataRowView getting the correct DataRow...

D

Doug

I have a an editable/sortable datagrid control that is bound to a dataview.
In my UpdateCommand event I pass in the EditItemIndex (the "row" in the grid
that is being edited)...the problem is that this "row" is not the same row
in the DataTable behind the DataView....So is there any way besides looping
through all of the DataRowView objects in the DataView to get the proper
data row? I thought there should be an .ITEMS property on the DataView that
contains all of the DataRowView objects?....Here is what I have to do
now...please let me know if there is an easer way....I hate iterating if I
don't have to...

DataGridControl
Public Function GetSomeData(EditItemIndex as integer) as HashTable
dim i as integer = 0
dim drv as datarowview
Dim dr as datarow
'm_dv is an instance variable with the given data view that the datagrid is
bound to....
For each drv in m_dv
If i = EditItemIndex then
dr = drv.Row
exit for
End if
Next

'Get my data
dim ocol as datacolumn
for each ocol in m_dv.Table.Columns
oHash.add(ocol.ColumnName,dr(ocol.ColumnName))
next

return oHash

Thanks Doug
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top