views:

29

answers:

1

I'd like to iterate through all the rows in a gridview and retrieve data from RepositoryLookupEdit.

Basically I'd like to do this, but I don't know how to get the RepositoryLookupEdit:

 For i as Int32 = 0 to myGridView.RowCount -1
   Dim row As DataRowView = CType(myGridView.GetRow(i), DataRowView)
   //'This next line does not work
   Dim lue As LookUpEdit = row.Item("myColumn").myRepLookupEdit
   Dim drv As DataRowView = CType(editor.Properties.GetDataSourceRowByKeyValue(lue.EditValue), DataRowView)
   Dim myData As Int32 = CType(drv("myData"), Int32)
 Next
+1  A: 

Hi,

I think that you should use the following code:

For i as Int32 = 0 to myGridView.RowCount -1

   Dim cellValue As object = myGridView.GetRowCellValue(i, "myColumn")
   dim dView as DataView = new DataView(repositoryItemGridLookupEdit.DataSource) ' you should pass a DataTable instance here

   dim rowIndex as integer = dView.Find(cellValue)
   dim otherCellValue as object = dview(rowIndex)("myData")
 Next

Does this work for you?

DevExpress Team
This worked great, I had a BindingSource as my DataSource, so I had ctype the datasource to my dataset and then reference my datatable
Nathan Koop