从GridView获取RepositoryLookupEdit

时间:2010-07-19 13:13:22

标签: gridview devexpress repositorylookupedit

我想遍历gridview中的所有行并从RepositoryLookupEdit中检索数据。

基本上我想这样做,但我不知道如何获取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 个答案:

答案 0 :(得分:1)

我认为您应该使用以下代码:

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

这对你有用吗?