从 GridView 获取 RepositoryLookupEdit

发布于 2024-09-10 10:45:14 字数 511 浏览 7 评论 0原文

我想迭代 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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

违心° 2024-09-17 10:45:14

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

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

这对您有用吗?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文