我使用的devexpress Gridcontrol/Gridview
有4列
Name: String
Description: String
Action: RepositoryItemLookUpEdit
Info: RepositoryItemHyperLinkEdit
现在我想写一个updates
Action-column
的函数,但只有当Value
datasource
中包含RepositoryItemLookUpEdit
时才会这样做p>
所以我开始编写代码,这就是我得到的方式:
For i As Integer = 0 To GridViewDD.RowCount - 1
Dim j As Integer = i
Dim rItemlookup As RepositoryItemLookUpEdit = CType(GridViewDD.GetRow(i), DataRowView).Item("Actions")
If CType(rItemlookup.DataSource, List(Of String)).Contains(curraction) Then
// Do update of the datasource here (which works)
End If
Next
GridControlDD.RefreshDataSource()
我的问题在于:
Dim rItemlookup As RepositoryItemLookUpEdit = CType(GridViewDD.GetRow(i), DataRowView).Item("Actions")
问题: 如何在devexpress(或其数据源)中获取单元格的RepositoryItemLookUpEdit?
注意:
我的gridview(GridViewDD
)的数据源是List
我RepositoryItemLookUpEdit
Action
的数据源总是List(Of String)
注2:
我的contents
从行到行的datasource may vary
答案 0 :(得分:1)
您可以轻松地从GridColumn.ColumnEdit
财产获取RepositoryItem
这是一个例子:
Dim rItemlookup As RepositoryItemLookUpEdit = GridViewDD.Columns("Action").ColumnEdit
'...
For i As Integer = 0 To GridViewDD.RowCount - 1
Dim j As Integer = i
If CType(rItemlookup.DataSource, List(Of String)).Contains(curraction) Then
'... Do update of the datasource here (which works)
End If
Next
GridControlDD.RefreshDataSource()
答案 1 :(得分:0)
我找到了。感谢'很多'小时浏览devexpress论坛。使用Gridviewinfo和GridDataRowInfo
,您可以轻松访问网格内隐藏的控件
在我的情况下,代码如下所示
Dim gvInfo As GridViewInfo = GridViewDD.GetViewInfo()
Dim rInfo As GridDataRowInfo = gvInfo.RowsInfo.FindRow(i)
Dim rItemlookup As RepositoryItemLookUpEdit = rInfo.Cells(GridViewDragDrop.Columns.Item("Actions")).Editor
您现在可以使用rItemlookup
更改或访问其属性。
我希望这对任何人都有用。