开发者

Get RepositoryLookupEdit from GridView

开发者 https://www.devze.com 2023-01-07 17:27 出处:网络
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:

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.EditVal开发者_Python百科ue), DataRowView)
   Dim myData As Int32 = CType(drv("myData"), Int32)
 Next


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消